function ToolkitTestTrait::assertImageEffect

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Traits/Core/Image/ToolkitTestTrait.php \Drupal\Tests\Traits\Core\Image\ToolkitTestTrait::assertImageEffect()
  2. 10 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.

8 calls to ToolkitTestTrait::assertImageEffect()
ImageEffectsTest::testConvertEffect in core/modules/image/tests/src/Kernel/ImageEffectsTest.php
Tests the 'image_convert' effect.
ImageEffectsTest::testCropEffect in core/modules/image/tests/src/Kernel/ImageEffectsTest.php
Tests the 'image_crop' effect.
ImageEffectsTest::testDesaturateEffect in core/modules/image/tests/src/Kernel/ImageEffectsTest.php
Tests the 'image_desaturate' effect.
ImageEffectsTest::testResizeEffect in core/modules/image/tests/src/Kernel/ImageEffectsTest.php
Tests the 'image_resize' effect.
ImageEffectsTest::testRotateEffect in core/modules/image/tests/src/Kernel/ImageEffectsTest.php
Tests the image_rotate_effect() function.

... See full list

File

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

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();
    // The test toolkit does not actually implement the operation plugins,
    // therefore the calls to TestToolkit::apply() will fail. That's not a
    // problem here, we are not testing the actual operations.
    $this->assertFalse($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.