function ImageTest::getToolkitMock

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

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()
        ->setMethods($stubs)
        ->getMock();
}

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