You are here

public function MigrateMenuTest::testMenu in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Migrate/MigrateMenuTest.php \Drupal\system\Tests\Migrate\MigrateMenuTest::testMenu()

Tests the Drupal 6 menu to Drupal 8 migration.

File

core/modules/system/src/Tests/Migrate/MigrateMenuTest.php, line 33
Contains \Drupal\system\Tests\Migrate\MigrateMenuTest.

Class

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

Namespace

Drupal\system\Tests\Migrate

Code

public function testMenu() {
  $navigation_menu = Menu::load('navigation');
  $this
    ->assertIdentical('navigation', $navigation_menu
    ->id());
  $this
    ->assertIdentical('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
    ->assertIdentical($expected, $navigation_menu
    ->getDescription());

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