public function ImageEffectsTest::testScaleAndCropEffectWithAnchor in Drupal 9
Tests the 'image_scale_and_crop' effect with an anchor.
File
- core/
modules/ image/ tests/ src/ Kernel/ ImageEffectsTest.php, line 144
Class
- ImageEffectsTest
- Tests image effects.
Namespace
Drupal\Tests\image\KernelCode
public function testScaleAndCropEffectWithAnchor() {
$this
->assertImageEffect([
'scale_and_crop',
], 'image_scale_and_crop', [
'anchor' => 'top-1',
'width' => 5,
'height' => 10,
]);
// Check the parameters.
$calls = $this
->imageTestGetAllCalls();
// X was computed and passed correctly.
$this
->assertEquals(0, $calls['scale_and_crop'][0][0]);
// Y was computed and passed correctly.
$this
->assertEquals(1, $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]);
}