You are here

protected function ImageTest::getToolkitMock in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()
  2. 9 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()

Mocks a toolkit.

Parameters

array $stubs: (optional) Array containing methods to be replaced with stubs.

Return value

\PHPUnit\Framework\MockObject\MockObject

5 calls to ImageTest::getToolkitMock()
ImageTest::getTestImage in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Get an image with a mocked toolkit, for testing.
ImageTest::getTestImageForOperation in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Get an image with mocked toolkit and operation, for operation testing.
ImageTest::testChmodFails in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::save().
ImageTest::testParseFileFails in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::parseFile().
ImageTest::testSave in core/tests/Drupal/Tests/Core/Image/ImageTest.php
Tests \Drupal\Core\Image\Image::save().

File

core/tests/Drupal/Tests/Core/Image/ImageTest.php, line 62

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

protected function getToolkitMock(array $stubs = []) {
  $mock_builder = $this
    ->getMockBuilder('Drupal\\system\\Plugin\\ImageToolkit\\GDToolkit');
  $stubs = array_merge([
    'getPluginId',
    'save',
  ], $stubs);
  return $mock_builder
    ->disableOriginalConstructor()
    ->onlyMethods($stubs)
    ->getMock();
}