function ToolkitTestTrait::assertImageEffect

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Traits/Core/Image/ToolkitTestTrait.php \Drupal\Tests\Traits\Core\Image\ToolkitTestTrait::assertImageEffect()

Asserts the effect processing of an image effect plugin.

Parameters

string[] $expected_operations: String array containing the operation names, e.g. load, save, crop, etc.

string $effect_name: The name of the image effect to test.

array $data: The data to be passed to the image effect.

File

core/tests/Drupal/Tests/Traits/Core/Image/ToolkitTestTrait.php, line 100

Class

ToolkitTestTrait
Provides common methods for image toolkit kernel tests.

Namespace

Drupal\Tests\Traits\Core\Image

Code

protected function assertImageEffect(array $expected_operations, string $effect_name, array $data) : void {
  $effect = $this->imageEffectPluginManager
    ->createInstance($effect_name, [
    'data' => $data,
  ]);
  $image = $this->getImage();
  $this->imageTestReset();
  $this->assertTrue($effect->applyEffect($image));
  $this->assertToolkitOperationsCalled($expected_operations);
}

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