You are here

public function MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage in Drupal 8

Same name in this branch
  1. 8 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
  2. 8 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
Same name and namespace in other branches
  1. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()

Tests language_default migration with a non-existing language.

File

core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php, line 38

Class

MigrateDefaultLanguageTest
Tests the default language variable migration.

Namespace

Drupal\Tests\language\Kernel\Migrate\d7

Code

public function testMigrationWithNonExistentLanguage() {
  $this
    ->setDefaultLanguage('tv');
  $this
    ->startCollectingMessages();
  $this
    ->executeMigrations([
    'language',
    'default_language',
  ]);

  // Tests the migration log contains an error message.
  $messages = $this->migration
    ->getIdMap()
    ->getMessages();
  $count = 0;
  foreach ($messages as $message) {
    $count++;
    $this
      ->assertSame("The language 'tv' does not exist on this site.", $message->message);
    $this
      ->assertSame(MigrationInterface::MESSAGE_ERROR, (int) $message->level);
  }
  $this
    ->assertSame(1, $count);
}