function ToolkitTest::testScale

Test the image_scale() function.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php, line 70
Definition of Drupal\system\Tests\Image\ToolkitTest.

Class

ToolkitTest
Test that the functions in image.inc correctly pass data to the toolkit.

Namespace

Drupal\system\Tests\Image

Code

function testScale() {

  // TODO: need to test upscaling
  $this
    ->assertTrue(image_scale($this->image, 10, 10), 'Function returned the expected value.');
  $this
    ->assertToolkitOperationsCalled(array(
    'resize',
  ));

  // Check the parameters.
  $calls = $this
    ->imageTestGetAllCalls();
  $this
    ->assertEqual($calls['resize'][0][1], 10, 'Width was passed correctly');
  $this
    ->assertEqual($calls['resize'][0][2], 5, 'Height was based off aspect ratio and passed correctly');
}