function ImageEffectsTest::testScaleAndCropEffect
Same name in other branches
- 9 core/modules/image/tests/src/Kernel/ImageEffectsTest.php \Drupal\Tests\image\Kernel\ImageEffectsTest::testScaleAndCropEffect()
- 8.9.x core/modules/image/tests/src/Functional/ImageEffectsTest.php \Drupal\Tests\image\Functional\ImageEffectsTest::testScaleAndCropEffect()
- 10 core/modules/image/tests/src/Kernel/ImageEffectsTest.php \Drupal\Tests\image\Kernel\ImageEffectsTest::testScaleAndCropEffect()
Tests the 'image_scale_and_crop' effect.
File
-
core/
modules/ image/ tests/ src/ Kernel/ ImageEffectsTest.php, line 125
Class
- ImageEffectsTest
- Tests image effects.
Namespace
Drupal\Tests\image\KernelCode
public function testScaleAndCropEffect() : void {
$this->assertImageEffect([
'scale_and_crop',
], 'image_scale_and_crop', [
'width' => 5,
'height' => 10,
]);
// Check the parameters.
$calls = $this->imageTestGetAllCalls();
// X was computed and passed correctly.
$this->assertEquals(7.5, $calls['scale_and_crop'][0][0]);
// Y was computed and passed correctly.
$this->assertEquals(0, $calls['scale_and_crop'][0][1]);
// Width was computed and passed correctly.
$this->assertEquals(5, $calls['scale_and_crop'][0][2]);
// Height was computed and passed correctly.
$this->assertEquals(10, $calls['scale_and_crop'][0][3]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.