You are here

public function MigrateMenuTest::testMenu in Drupal 8

Same name in this branch
  1. 8 core/modules/system/tests/src/Kernel/Migrate/d6/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d6\MigrateMenuTest::testMenu()
  2. 8 core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d7\MigrateMenuTest::testMenu()
Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Kernel/Migrate/d6/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d6\MigrateMenuTest::testMenu()

Tests the Drupal 6 menu to Drupal 8 migration.

File

core/modules/system/tests/src/Kernel/Migrate/d6/MigrateMenuTest.php, line 27

Class

MigrateMenuTest
Upgrade menus to system.menu.*.yml.

Namespace

Drupal\Tests\system\Kernel\Migrate\d6

Code

public function testMenu() {
  $navigation_menu = Menu::load('navigation');
  $this
    ->assertSame('navigation', $navigation_menu
    ->id());
  $this
    ->assertSame('Navigation', $navigation_menu
    ->label());
  $expected = <<<EOT
The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.
EOT;
  $this
    ->assertSame($expected, $navigation_menu
    ->getDescription());

  // Test that we can re-import using the ConfigEntityBase destination.
  Database::getConnection('default', 'migrate')
    ->update('menu_custom')
    ->fields([
    'title' => 'Home Navigation',
  ])
    ->condition('menu_name', 'navigation')
    ->execute();
  $migration = $this
    ->getMigration('d6_menu');
  \Drupal::database()
    ->truncate($migration
    ->getIdMap()
    ->mapTableName())
    ->execute();
  $this
    ->executeMigration($migration);
  $navigation_menu = Menu::load('navigation');
  $this
    ->assertSame('Home Navigation', $navigation_menu
    ->label());
}