You are here

function ImageEffectsTest::testScaleEffect in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/src/Tests/ImageEffectsTest.php \Drupal\image\Tests\ImageEffectsTest::testScaleEffect()

Test the image_scale_effect() function.

File

core/modules/image/src/Tests/ImageEffectsTest.php, line 57
Contains \Drupal\image\Tests\ImageEffectsTest.

Class

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

Namespace

Drupal\image\Tests

Code

function testScaleEffect() {

  // @todo: need to test upscaling.
  $this
    ->assertImageEffect('image_scale', array(
    'width' => 10,
    'height' => 10,
  ));
  $this
    ->assertToolkitOperationsCalled(array(
    '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');
}