function MenuRouterTest::testMenuLinkOptions

Test menu link 'options' storage and rendering.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php, line 503
Definition of Drupal\system\Tests\Menu\MenuRouterTest.

Class

MenuRouterTest
Tests menu router and hook_menu() functionality.

Namespace

Drupal\system\Tests\Menu

Code

function testMenuLinkOptions() {

  // Create a menu link with options.
  $menu_link = entity_create('menu_link', array(
    'link_title' => 'Menu link options test',
    'link_path' => 'test-page',
    'module' => 'menu_test',
    'options' => array(
      'attributes' => array(
        'title' => 'Test title attribute',
      ),
      'query' => array(
        'testparam' => 'testvalue',
      ),
    ),
  ));
  menu_link_save($menu_link);

  // Load front page.
  $this
    ->drupalGet('test-page');
  $this
    ->assertRaw('title="Test title attribute"', 'Title attribute of a menu link renders.');
  $this
    ->assertRaw('testparam=testvalue', 'Query parameter added to menu link.');
}