function ToolkitTest::testDerivative
Same name in other branches
- 8.9.x core/tests/Drupal/FunctionalTests/Image/ToolkitTest.php \Drupal\FunctionalTests\Image\ToolkitTest::testDerivative()
- 10 core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php \Drupal\KernelTests\Core\Image\ToolkitTest::testDerivative()
- 11.x core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php \Drupal\KernelTests\Core\Image\ToolkitTest::testDerivative()
Tests image toolkit operations inheritance by derivative toolkits.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Image/ ToolkitTest.php, line 113
Class
- ToolkitTest
- Tests the image toolkit.
Namespace
Drupal\KernelTests\Core\ImageCode
public function testDerivative() {
$toolkit_manager = $this->container
->get('image.toolkit.manager');
$operation_manager = $this->container
->get('image.toolkit.operation.manager');
$toolkit = $toolkit_manager->createInstance('test:derived_toolkit');
$this->assertInstanceOf(ImageToolkitInterface::class, $toolkit);
// Load an overwritten and an inherited operation.
$blur = $operation_manager->getToolkitOperation($toolkit, 'blur');
$invert = $operation_manager->getToolkitOperation($toolkit, 'invert');
// 'Blur' operation overwritten by derivative.
$this->assertEquals('foo_derived', $blur->getPluginId());
// "Invert" operation inherited from base plugin.
$this->assertEquals('bar', $invert->getPluginId());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.