public function ToolkitTest::testDerivative in Drupal 9
Tests image toolkit operations inheritance by derivative toolkits.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Image/ ToolkitTest.php, line 106
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());
}