function MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage

Same name in this branch
  1. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
  2. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
  3. 10 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
  4. 10 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
  5. 11.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage()
  6. 11.x 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/d6/MigrateDefaultLanguageTest.php, line 38

Class

MigrateDefaultLanguageTest
Tests the default language variable migration.

Namespace

Drupal\Tests\language\Kernel\Migrate\d6

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);
}

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