3 namespace Drupal\Tests\language\Functional\Migrate;
5 use Drupal\language\ConfigurableLanguageInterface;
6 use Drupal\language\Entity\ConfigurableLanguage;
7 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
10 * @group migrate_drupal_6
12 class MigrateLanguageTest extends MigrateDrupal6TestBase {
17 public static $modules = ['language'];
20 * Asserts various properties of a configurable language entity.
24 * @param string $label
26 * @param string $direction
27 * (optional) The language's direction (one of the DIRECTION_* constants in
28 * ConfigurableLanguageInterface). Defaults to LTR.
30 * (optional) The weight of the language. Defaults to 0.
32 protected function assertLanguage($id, $label, $direction = ConfigurableLanguageInterface::DIRECTION_LTR, $weight = 0) {
33 /** @var \Drupal\language\ConfigurableLanguageInterface $language */
34 $language = ConfigurableLanguage::load($id);
35 $this->assertTrue($language instanceof ConfigurableLanguageInterface);
36 $this->assertIdentical($label, $language->label());
37 $this->assertIdentical($direction, $language->getDirection());
38 $this->assertIdentical(0, $language->getWeight());
39 $this->assertFalse($language->isLocked());
43 * Tests migration of Drupal 6 languages to configurable language entities.
45 public function testLanguageMigration() {
46 $this->executeMigration('language');
47 $this->assertLanguage('en', 'English');
48 $this->assertLanguage('fr', 'French');