You are here

protected function MigrateImageCacheTest::assertImageEffect in Drupal 9

Same name and namespace in other branches
  1. 8 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()

Assert that a given image effect is migrated.

Parameters

array $collection: Collection of effects

$id: Id that should exist in the collection.

$config: Expected configuration for the collection.

Return value

bool

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 153

Class

MigrateImageCacheTest
Tests migration of ImageCache presets to image styles.

Namespace

Drupal\Tests\image\Kernel\Migrate\d6

Code

protected function assertImageEffect($collection, $id, $config) {

  /** @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 succeed and return.
      return TRUE;
    }
  }

  // The loop did not find the effect so we it was not imported correctly.
  return $this
    ->fail('Effect ' . $id . ' did not import correctly');
}