You are here

protected function ImageTest::getToolkitMock 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::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 65
Contains \Drupal\Tests\Core\Image\ImageTest.

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

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