function ImageTest::getToolkitMock

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()
  2. 10 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()
  3. 8.9.x 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

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.