function ImageEffectsTest::testScaleEffect

Same name in other branches
  1. 9 core/modules/image/tests/src/Kernel/ImageEffectsTest.php \Drupal\Tests\image\Kernel\ImageEffectsTest::testScaleEffect()
  2. 8.9.x core/modules/image/tests/src/Functional/ImageEffectsTest.php \Drupal\Tests\image\Functional\ImageEffectsTest::testScaleEffect()
  3. 10 core/modules/image/tests/src/Kernel/ImageEffectsTest.php \Drupal\Tests\image\Kernel\ImageEffectsTest::testScaleEffect()

Tests the 'image_scale' effect.

File

core/modules/image/tests/src/Kernel/ImageEffectsTest.php, line 67

Class

ImageEffectsTest
Tests image effects.

Namespace

Drupal\Tests\image\Kernel

Code

public function testScaleEffect() : void {
    // @todo Test also image upscaling in #3040887.
    // @see https://www.drupal.org/project/drupal/issues/3040887
    $this->assertImageEffect([
        'scale',
    ], 'image_scale', [
        'width' => 10,
        'height' => 10,
    ]);
    // Check the parameters.
    $calls = $this->imageTestGetAllCalls();
    // Width was passed correctly.
    $this->assertEquals(10, $calls['scale'][0][0]);
    // Height was based off aspect ratio and passed correctly.
    $this->assertEquals(10, $calls['scale'][0][1]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.