You are here

public function ImageTest::testCropHeight in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testCropHeight()

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

File

core/tests/Drupal/Tests/Core/Image/ImageTest.php, line 367
Contains \Drupal\Tests\Core\Image\ImageTest.

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

public function testCropHeight() {
  $this
    ->getTestImageForOperation('Crop');
  $this->toolkitOperation
    ->expects($this
    ->once())
    ->method('execute')
    ->will($this
    ->returnArgument(0));

  // Cropping with height only should preserve the aspect ratio.
  $ret = $this->image
    ->crop(0, 0, NULL, 50);
  $this
    ->assertEquals(44, $ret['width']);
}