function MigrateImageCacheTest::assertImageEffect

Same name in other branches
  1. 8.9.x core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php \Drupal\Tests\image\Kernel\Migrate\d6\MigrateImageCacheTest::assertImageEffect()
  2. 10 core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php \Drupal\Tests\image\Kernel\Migrate\d6\MigrateImageCacheTest::assertImageEffect()
  3. 11.x core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php \Drupal\Tests\image\Kernel\Migrate\d6\MigrateImageCacheTest::assertImageEffect()

Assert that a given image effect is migrated.

@internal

Parameters

\Drupal\image\ImageEffectPluginCollection $collection: Collection of effects

string $id: Id that should exist in the collection.

array $config: Expected configuration for the collection.

1 call to MigrateImageCacheTest::assertImageEffect()
MigrateImageCacheTest::testPassingMigration in core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php
Tests basic passing migrations.

File

core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php, line 154

Class

MigrateImageCacheTest
Tests migration of ImageCache presets to image styles.

Namespace

Drupal\Tests\image\Kernel\Migrate\d6

Code

protected function assertImageEffect(ImageEffectPluginCollection $collection, string $id, array $config) : void {
    
    /** @var \Drupal\image\ConfigurableImageEffectBase $effect */
    foreach ($collection as $effect) {
        $effect_config = $effect->getConfiguration();
        if ($effect_config['id'] == $id && $effect_config['data'] == $config) {
            // We found this effect so the assertion is successful.
            return;
        }
    }
    // The loop did not find the effect so we it was not imported correctly.
    $this->fail('Effect ' . $id . ' did not import correctly');
}

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