function ImageEffectsTest::testScaleEffect

Test the image_scale_effect() function.

File

core/modules/image/tests/src/Functional/ImageEffectsTest.php, line 58

Class

ImageEffectsTest
Tests that the image effects pass parameters to the toolkit correctly.

Namespace

Drupal\Tests\image\Functional

Code

public function testScaleEffect() {
  // @todo: need to test upscaling.
  $this->assertImageEffect('image_scale', [
    'width' => 10,
    'height' => 10,
  ]);
  $this->assertToolkitOperationsCalled([
    'scale',
  ]);
  // Check the parameters.
  $calls = $this->imageTestGetAllCalls();
  $this->assertEqual($calls['scale'][0][0], 10, 'Width was passed correctly');
  $this->assertEqual($calls['scale'][0][1], 10, 'Height was based off aspect ratio and passed correctly');
}

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