function MigrateMenuLinkTest::testMenuLinks

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

Tests migration of menu links.

File

core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php, line 90

Class

MigrateMenuLinkTest
Menu link migration.

Namespace

Drupal\Tests\menu_link_content\Kernel\Migrate\d6

Code

public function testMenuLinks() {
    $this->assertEntity('138', 'Test 1', 'secondary-links', 'Test menu link 1', TRUE, FALSE, [
        'attributes' => [
            'title' => 'Test menu link 1',
        ],
        'langcode' => 'en',
    ], 'internal:/user/login', -50);
    $this->assertEntity('139', 'Test 2', 'secondary-links', 'Test menu link 2', TRUE, TRUE, [
        'query' => 'foo=bar',
        'attributes' => [
            'title' => 'Test menu link 2',
        ],
    ], 'internal:/admin', -49);
    $this->assertEntity('140', 'Drupal.org', 'secondary-links', NULL, TRUE, FALSE, [
        'attributes' => [
            'title' => '',
        ],
    ], 'https://www.drupal.org', -50);
    // Assert that missing title attributes don't stop or break migration.
    $this->assertEntity('393', 'Test 3', 'secondary-links', NULL, TRUE, FALSE, [], 'internal:/user/login', -47);
    // Test the migration of menu links for translated nodes.
    $this->assertEntity('459', 'The Real McCoy', 'primary-links', NULL, TRUE, FALSE, [
        'attributes' => [
            'title' => '',
        ],
        'alter' => TRUE,
    ], 'entity:node/10', 0);
    $this->assertEntity('460', 'Le Vrai McCoy', 'primary-links', NULL, TRUE, FALSE, [
        'attributes' => [
            'title' => '',
        ],
        'alter' => TRUE,
    ], 'entity:node/10', 0);
    $this->assertEntity('461', 'Abantu zulu', 'primary-links', NULL, TRUE, FALSE, [
        'attributes' => [
            'title' => '',
        ],
        'alter' => TRUE,
    ], 'entity:node/12', 0);
    $this->assertEntity('462', 'The Zulu People', 'primary-links', NULL, TRUE, FALSE, [
        'attributes' => [
            'title' => '',
        ],
        'alter' => TRUE,
    ], 'entity:node/12', 0);
    // Test the migration of menu links translation.
    $this->assertEntity('463', 'fr - Test 1', 'secondary-links', 'fr - Test menu link 1', TRUE, FALSE, [
        'attributes' => [
            'title' => 'fr - Test menu link 1',
        ],
        'langcode' => 'fr',
        'alter' => TRUE,
    ], 'internal:/user/login', -49);
}

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