You are here

public function ImageEffectsTest::testScaleEffect in Drupal 9

Tests the 'image_scale' effect.

File

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

Class

ImageEffectsTest
Tests image effects.

Namespace

Drupal\Tests\image\Kernel

Code

public function testScaleEffect() {

  // @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]);
}