You are here

public function ImageTest::testFloatResize in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testFloatResize()
  2. 9 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testFloatResize()

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

File

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

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

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

  // Pass a float for width.
  $ret = $this->image
    ->resize(30.4, 40);

  // Ensure that the float was rounded to an integer first.
  $this
    ->assertEquals(30, $ret['width']);
}