You are here

public function MigrateImageCacheTest::testMissingEffectPlugin in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/src/Tests/Migrate/d6/MigrateImageCacheTest.php \Drupal\image\Tests\Migrate\d6\MigrateImageCacheTest::testMissingEffectPlugin()

Test that missing actions causes failures.

File

core/modules/image/src/Tests/Migrate/d6/MigrateImageCacheTest.php, line 95
Contains \Drupal\image\Tests\Migrate\d6\MigrateImageCacheTest.

Class

MigrateImageCacheTest
Tests migration of ImageCache presets to image styles.

Namespace

Drupal\image\Tests\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 = $this->migration
    ->getIdMap()
    ->getMessageIterator();
  $count = 0;
  foreach ($messages as $message) {
    $count++;
    $this
      ->assertEqual($message->message, 'The "image_deprecated_scale" plugin does not exist.');
    $this
      ->assertEqual($message->level, MigrationInterface::MESSAGE_ERROR);
  }

  // There should be only the one message.
  $this
    ->assertEqual($count, 1);
}