You are here

public function MigrateImageCacheTest::testMissingEffectPlugin in Drupal 10

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::testMissingEffectPlugin()
  2. 9 core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php \Drupal\Tests\image\Kernel\Migrate\d6\MigrateImageCacheTest::testMissingEffectPlugin()

Tests that missing actions causes failures.

File

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

Class

MigrateImageCacheTest
Tests migration of ImageCache presets to image styles.

Namespace

Drupal\Tests\image\Kernel\Migrate\d6

Code

public function testMissingEffectPlugin() {
  Database::getConnection('default', 'migrate')
    ->insert("imagecache_action")
    ->fields([
    'presetid',
    'weight',
    'module',
    'action',
    'data',
  ])
    ->values([
    'presetid' => '1',
    'weight' => '0',
    'module' => 'imagecache',
    'action' => 'imagecache_deprecated_scale',
    'data' => 'a:3:{s:3:"fit";s:7:"outside";s:5:"width";s:3:"200";s:6:"height";s:3:"200";}',
  ])
    ->execute();
  $this
    ->startCollectingMessages();
  $this
    ->executeMigration('d6_imagecache_presets');
  $messages = iterator_to_array($this->migration
    ->getIdMap()
    ->getMessages());
  $this
    ->assertCount(1, $messages);
  $this
    ->assertStringContainsString('The "image_deprecated_scale" plugin does not exist.', $messages[0]->message);
  $this
    ->assertEquals(MigrationInterface::MESSAGE_ERROR, $messages[0]->level);
}