You are here

function ImageEffectsTest::testCropEffect 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::testCropEffect()

Test the image_crop_effect() function.

File

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

Class

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

Namespace

Drupal\image\Tests

Code

function testCropEffect() {

  // @todo should test the keyword offsets.
  $this
    ->assertImageEffect('image_crop', array(
    'anchor' => 'top-1',
    'width' => 3,
    'height' => 4,
  ));
  $this
    ->assertToolkitOperationsCalled(array(
    'crop',
  ));

  // Check the parameters.
  $calls = $this
    ->imageTestGetAllCalls();
  $this
    ->assertEqual($calls['crop'][0][0], 0, 'X was passed correctly');
  $this
    ->assertEqual($calls['crop'][0][1], 1, 'Y was passed correctly');
  $this
    ->assertEqual($calls['crop'][0][2], 3, 'Width was passed correctly');
  $this
    ->assertEqual($calls['crop'][0][3], 4, 'Height was passed correctly');
}