function ImageEffectsTest::testCropEffect

Test the image_crop_effect() function.

File

drupal/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php, line 69
Definition of Drupal\image\Tests\ImageEffectsTest.

Class

ImageEffectsTest
Use the image_test.module's mock toolkit to ensure that the effects are properly passing parameters to the image toolkit.

Namespace

Drupal\image\Tests

Code

function testCropEffect() {

  // @todo should test the keyword offsets.
  $this
    ->assertTrue(image_crop_effect($this->image, array(
    'anchor' => 'top-1',
    'width' => 3,
    'height' => 4,
  )), 'Function returned the expected value.');
  $this
    ->assertToolkitOperationsCalled(array(
    'crop',
  ));

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