function MigrateMenuTest::testMenu

Same name in this branch
  1. 9 core/modules/system/tests/src/Kernel/Migrate/d6/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d6\MigrateMenuTest::testMenu()
Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Kernel/Migrate/d6/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d6\MigrateMenuTest::testMenu()
  2. 8.9.x core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d7\MigrateMenuTest::testMenu()
  3. 10 core/modules/system/tests/src/Kernel/Migrate/d6/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d6\MigrateMenuTest::testMenu()
  4. 10 core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d7\MigrateMenuTest::testMenu()
  5. 11.x core/modules/system/tests/src/Kernel/Migrate/d6/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d6\MigrateMenuTest::testMenu()
  6. 11.x core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php \Drupal\Tests\system\Kernel\Migrate\d7\MigrateMenuTest::testMenu()

Tests the Drupal 7 menu to Drupal 8 migration.

File

core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php, line 49

Class

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

Namespace

Drupal\Tests\system\Kernel\Migrate\d7

Code

public function testMenu() {
    $this->assertEntity('main', 'und', 'Main menu', 'The <em>Main</em> menu is used on many sites to show the major sections of the site, often in a top navigation bar.');
    $this->assertEntity('admin', 'und', 'Management', 'The <em>Management</em> menu contains links for administrative tasks.');
    $this->assertEntity('menu-test-menu', 'und', 'Test Menu', 'Test menu description.');
    $this->assertEntity('tools', 'und', 'Navigation', 'The <em>Navigation</em> menu contains links intended for site visitors. Links are added to the <em>Navigation</em> menu automatically by some modules.');
    $this->assertEntity('account', 'und', 'User menu', 'The <em>User</em> menu contains links related to the user\'s account, as well as the \'Log out\' link.');
    $this->assertEntity('menu-fixedlang', 'is', 'FixedLang', '');
    // 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('d7_menu');
    \Drupal::database()->truncate($migration->getIdMap()
        ->mapTableName())
        ->execute();
    $this->executeMigration($migration);
    $navigation_menu = Menu::load('tools');
    $this->assertSame('Home Navigation', $navigation_menu->label());
}

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