You are here

protected function ImageTest::getTestImageForOperation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getTestImageForOperation()

Get an image with mocked toolkit and operation, for operation testing.

Parameters

string $class_name: The name of the GD toolkit operation class to be mocked.

Return value

\Drupal\Core\Image\Image An image object.

14 calls to ImageTest::getTestImageForOperation()
ImageTest::testConvert in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::convert().
ImageTest::testCrop in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::crop().
ImageTest::testCropHeight in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::crop().
ImageTest::testCropWidth in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::crop().
ImageTest::testDesaturate in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::desaturate().

... See full list

File

core/tests/Drupal/Tests/Core/Image/ImageTest.php, line 133
Contains \Drupal\Tests\Core\Image\ImageTest.

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

protected function getTestImageForOperation($class_name) {
  $this->toolkit = $this
    ->getToolkitMock(array(
    'getToolkitOperation',
  ));
  $this->toolkitOperation = $this
    ->getToolkitOperationMock($class_name, $this->toolkit);
  $this->toolkit
    ->expects($this
    ->any())
    ->method('getPluginId')
    ->will($this
    ->returnValue('gd'));
  $this->toolkit
    ->expects($this
    ->any())
    ->method('getToolkitOperation')
    ->will($this
    ->returnValue($this->toolkitOperation));
  $this->image = new Image($this->toolkit, $this->source);
}