function ImageTest::testFloatResize

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testFloatResize()
  2. 8.9.x core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testFloatResize()
  3. 10 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 447

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

public function testFloatResize() : void {
    $this->getTestImageForOperation('Resize');
    $this->toolkitOperation
        ->expects($this->once())
        ->method('execute')
        ->willReturnArgument(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']);
}

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