You are here

public function ImageEffectsTest::testCropEffect in Drupal 8

Test the image_crop_effect() function.

File

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

Class

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

Namespace

Drupal\Tests\image\Functional

Code

public function testCropEffect() {

  // @todo should test the keyword offsets.
  $this
    ->assertImageEffect('image_crop', [
    'anchor' => 'top-1',
    'width' => 3,
    'height' => 4,
  ]);
  $this
    ->assertToolkitOperationsCalled([
    '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');
}