function ImageToolkitUnitTest::testCrop in Drupal 7
Test the image_crop() function.
File
- modules/
simpletest/ tests/ image.test, line 175 - Tests for core image handling API.
Class
- ImageToolkitUnitTest
- Test that the functions in image.inc correctly pass data to the toolkit.
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 = image_test_get_all_calls();
$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');
}