MigrateLanguageContentMenuSettingsTest.php in Drupal 9
File
core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php
View source
<?php
namespace Drupal\Tests\language\Kernel\Migrate\d6;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language\Entity\ContentLanguageSettings;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateLanguageContentMenuSettingsTest extends MigrateDrupal6TestBase {
protected static $modules = [
'language',
'content_translation',
'menu_link_content',
];
protected function setUp() : void {
parent::setUp();
ConfigurableLanguage::createFromLangcode('en')
->save();
ConfigurableLanguage::createFromLangcode('fr')
->save();
$this
->executeMigrations([
'language',
'd6_language_content_menu_settings',
]);
}
public function testLanguageMenuContent() {
$config = ContentLanguageSettings::load('menu_link_content.menu_link_content');
$this
->assertInstanceOf(ContentLanguageSettings::class, $config);
$this
->assertSame('menu_link_content', $config
->getTargetEntityTypeId());
$this
->assertSame('menu_link_content', $config
->getTargetBundle());
$this
->assertSame(LanguageInterface::LANGCODE_SITE_DEFAULT, $config
->getDefaultLangcode());
$this
->assertTrue($config
->isLanguageAlterable());
$this->sourceDatabase
->update('system')
->fields([
'status' => 0,
])
->condition('name', 'i18nmenu')
->execute();
$migration = $this
->getMigration('d6_language_content_menu_settings');
$migration
->getIdMap()
->prepareUpdate();
$this
->executeMigration($migration);
$config = ContentLanguageSettings::load('menu_link_content.menu_link_content');
$this
->assertInstanceOf(ContentLanguageSettings::class, $config);
$this
->assertSame('menu_link_content', $config
->getTargetEntityTypeId());
$this
->assertSame('menu_link_content', $config
->getTargetBundle());
$this
->assertSame(LanguageInterface::LANGCODE_SITE_DEFAULT, $config
->getDefaultLangcode());
$this
->assertFalse($config
->isLanguageAlterable());
}
}