You are here

public function ToolkitTest::testDerivative in Drupal 8

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.');
}