MigrateLanguageTest.php in Drupal 10
File
core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php
View source
<?php
namespace Drupal\Tests\language\Kernel\Migrate\d6;
use Drupal\language\ConfigurableLanguageInterface;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateLanguageTest extends MigrateDrupal6TestBase {
protected static $modules = [
'language',
];
protected function assertLanguage(string $id, string $label, string $direction = ConfigurableLanguageInterface::DIRECTION_LTR, int $weight = 0) : void {
$language = ConfigurableLanguage::load($id);
$this
->assertInstanceOf(ConfigurableLanguageInterface::class, $language);
$this
->assertSame($label, $language
->label());
$this
->assertSame($direction, $language
->getDirection());
$this
->assertSame(0, $language
->getWeight());
$this
->assertFalse($language
->isLocked());
}
public function testLanguageMigration() {
$this
->executeMigration('language');
$this
->assertLanguage('en', 'English');
$this
->assertLanguage('fr', 'French');
}
}