function ImageTest::testCropWidth

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testCropWidth()
  2. 8.9.x core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testCropWidth()
  3. 10 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testCropWidth()

Tests \Drupal\Core\Image\Image::crop().

File

core/tests/Drupal/Tests/Core/Image/ImageTest.php, line 378

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

public function testCropWidth() : void {
    $this->getTestImageForOperation('Crop');
    $this->toolkitOperation
        ->expects($this->once())
        ->method('execute')
        ->willReturnArgument(0);
    // Cropping with width only should preserve the aspect ratio.
    $ret = $this->image
        ->crop(0, 0, 44);
    $this->assertEquals(50, $ret['height']);
}

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