function MigrateLanguageContentMenuSettingsTest::testLanguageMenuContent

Same name in other branches
  1. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentMenuSettingsTest::testLanguageMenuContent()
  2. 10 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentMenuSettingsTest::testLanguageMenuContent()
  3. 11.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentMenuSettingsTest::testLanguageMenuContent()

Tests migration of menu translation ability.

File

core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php, line 43

Class

MigrateLanguageContentMenuSettingsTest
Tests migration of the ability to translate menu content.

Namespace

Drupal\Tests\language\Kernel\Migrate\d6

Code

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());
    // Test that menus are not alterable when the i18nmenu is not enabled.
    $this->sourceDatabase
        ->update('system')
        ->fields([
        'status' => 0,
    ])
        ->condition('name', 'i18nmenu')
        ->execute();
    
    /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
    $migration = $this->getMigration('d6_language_content_menu_settings');
    // Indicate we're rerunning a migration that's already run.
    $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());
}

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