You are here

protected function ImageTest::getToolkitOperationMock in Drupal 8

Same name and namespace in other branches
  1. 9 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.

\Drupal\Core\Image\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 81

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
    ->createMock('Psr\\Log\\LoggerInterface');
  return $mock_builder
    ->setMethods([
    'execute',
  ])
    ->setConstructorArgs([
    [],
    '',
    [],
    $toolkit,
    $logger,
  ])
    ->getMock();
}