function ImageTest::getToolkitMock
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()
- 10 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()
- 9 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()
- 8.9.x core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getToolkitMock()
Mocks a toolkit.
Parameters
list<string> $stubs: (optional) Array containing methods to be replaced with stubs.
Return value
\Drupal\system\Plugin\ImageToolkit\GDToolkit&\PHPUnit\Framework\MockObject\MockObject Mocked GDToolkit instance.
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 66
Class
- ImageTest
- Tests the image class.
Namespace
Drupal\Tests\Core\ImageCode
protected function getToolkitMock(array $stubs = []) : GDToolkit&MockObject {
$mock_builder = $this->getMockBuilder(GDToolkit::class);
$stubs = array_merge([
'getPluginId',
'save',
], $stubs);
return $mock_builder->setConstructorArgs([
[],
'',
[],
$this->createStub(ImageToolkitOperationManagerInterface::class),
$this->createStub(LoggerInterface::class),
$this->createStub(ConfigFactoryInterface::class),
$this->createStub(StreamWrapperManagerInterface::class),
$this->createStub(FileSystemInterface::class),
])
->onlyMethods($stubs)
->getMock();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.