function ToolkitTest::testCrop

Test the image_crop() function.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php, line 113
Definition of Drupal\system\Tests\Image\ToolkitTest.

Class

ToolkitTest
Test that the functions in image.inc correctly pass data to the toolkit.

Namespace

Drupal\system\Tests\Image

Code

function testCrop() {
  $this
    ->assertTrue(image_crop($this->image, 1, 2, 3, 4), 'Function returned the expected value.');
  $this
    ->assertToolkitOperationsCalled(array(
    'crop',
  ));

  // Check the parameters.
  $calls = $this
    ->imageTestGetAllCalls();
  $this
    ->assertEqual($calls['crop'][0][1], 1, 'X was passed correctly');
  $this
    ->assertEqual($calls['crop'][0][2], 2, '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');
}