You are here

protected function ImageTest::getToolkitOperationMock 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::getToolkitOperationMock()

Mocks a toolkit operation.

Parameters

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

ImageToolkitInterface $toolkit: The image toolkit object.

Return value

\PHPUnit_Framework_MockObject_MockObject

1 call to ImageTest::getToolkitOperationMock()
ImageTest::getTestImageForOperation in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Get an image with mocked toolkit and operation, for operation testing.

File

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

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

protected function getToolkitOperationMock($class_name, ImageToolkitInterface $toolkit) {
  $mock_builder = $this
    ->getMockBuilder('Drupal\\system\\Plugin\\ImageToolkit\\Operation\\gd\\' . $class_name);
  $logger = $this
    ->getMock('Psr\\Log\\LoggerInterface');
  return $mock_builder
    ->setMethods(array(
    'execute',
  ))
    ->setConstructorArgs(array(
    array(),
    '',
    array(),
    $toolkit,
    $logger,
  ))
    ->getMock();
}