function ImageEffectsTest::testScaleEffect

Test the image_scale_effect() function.

File

drupal/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php, line 55
Definition of Drupal\image\Tests\ImageEffectsTest.

Class

ImageEffectsTest
Use the image_test.module's mock toolkit to ensure that the effects are properly passing parameters to the image toolkit.

Namespace

Drupal\image\Tests

Code

function testScaleEffect() {

  // @todo: need to test upscaling.
  $this
    ->assertTrue(image_scale_effect($this->image, array(
    'width' => 10,
    'height' => 10,
  )), 'Function returned the expected value.');
  $this
    ->assertToolkitOperationsCalled(array(
    'resize',
  ));

  // Check the parameters.
  $calls = image_test_get_all_calls();
  $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');
}