function ImageTest::testFloatResize

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

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