function ImageEffectsTest::testScaleAndCropEffect

Same name in other branches
  1. 9 core/modules/image/tests/src/Kernel/ImageEffectsTest.php \Drupal\Tests\image\Kernel\ImageEffectsTest::testScaleAndCropEffect()
  2. 10 core/modules/image/tests/src/Kernel/ImageEffectsTest.php \Drupal\Tests\image\Kernel\ImageEffectsTest::testScaleAndCropEffect()
  3. 11.x core/modules/image/tests/src/Kernel/ImageEffectsTest.php \Drupal\Tests\image\Kernel\ImageEffectsTest::testScaleAndCropEffect()

Test the image_scale_and_crop_effect() function.

File

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

Class

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

Namespace

Drupal\Tests\image\Functional

Code

public function testScaleAndCropEffect() {
    $this->assertImageEffect('image_scale_and_crop', [
        'width' => 5,
        'height' => 10,
    ]);
    $this->assertToolkitOperationsCalled([
        'scale_and_crop',
    ]);
    // Check the parameters.
    $calls = $this->imageTestGetAllCalls();
    $this->assertEqual($calls['scale_and_crop'][0][0], 7.5, 'X was computed and passed correctly');
    $this->assertEqual($calls['scale_and_crop'][0][1], 0, 'Y was computed and passed correctly');
    $this->assertEqual($calls['scale_and_crop'][0][2], 5, 'Width was computed and passed correctly');
    $this->assertEqual($calls['scale_and_crop'][0][3], 10, 'Height was computed and passed correctly');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.