function MenuLinkContentFormTest::testMenuLinkContentOperationsLink

Same name in other branches
  1. 11.x core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php \Drupal\Tests\menu_link_content\Functional\MenuLinkContentFormTest::testMenuLinkContentOperationsLink()

Tests the operations links alter related functional for menu_link_content.

File

core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php, line 118

Class

MenuLinkContentFormTest
Tests the menu link content UI.

Namespace

Drupal\Tests\menu_link_content\Functional

Code

public function testMenuLinkContentOperationsLink() : void {
    \Drupal::service('module_installer')->install([
        'menu_operations_link_test',
    ]);
    $menu_link = MenuLinkContent::create([
        'title' => 'Menu link test',
        'provider' => 'menu_link_content',
        'menu_name' => 'main',
        'link' => [
            'uri' => 'internal:/user/login',
        ],
    ]);
    $menu_link->save();
    // When we are on the listing page, we should be able to see the altered
    // values by alter hook in the operations link menu.
    $this->drupalGet('/admin/structure/menu/manage/main');
    $this->assertSession()
        ->linkExists('Altered Edit Title');
    $this->assertSession()
        ->linkExists('Custom Home');
}

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