function ToolkitTest::testDerivative

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php \Drupal\KernelTests\Core\Image\ToolkitTest::testDerivative()
  2. 10 core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php \Drupal\KernelTests\Core\Image\ToolkitTest::testDerivative()
  3. 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/FunctionalTests/Image/ToolkitTest.php, line 80

Class

ToolkitTest
Tests image toolkit functions.

Namespace

Drupal\FunctionalTests\Image

Code

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');
    // Load an overwritten and an inherited operation.
    $blur = $operation_manager->getToolkitOperation($toolkit, 'blur');
    $invert = $operation_manager->getToolkitOperation($toolkit, 'invert');
    $this->assertIdentical('foo_derived', $blur->getPluginId(), "'Blur' operation overwritten by derivative.");
    $this->assertIdentical('bar', $invert->getPluginId(), '"Invert" operation inherited from base plugin.');
}

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