You are here

public function LocalActionTest::testLocalAction in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Menu/LocalActionTest.php \Drupal\system\Tests\Menu\LocalActionTest::testLocalAction()

Tests appearance of local actions.

File

core/modules/system/src/Tests/Menu/LocalActionTest.php, line 40
Contains \Drupal\system\Tests\Menu\LocalActionTest.

Class

LocalActionTest
Tests local actions derived from router and added/altered via hooks.

Namespace

Drupal\system\Tests\Menu

Code

public function testLocalAction() {
  $this
    ->drupalGet('menu-test-local-action');

  // Ensure that both menu and route based actions are shown.
  $this
    ->assertLocalAction([
    [
      Url::fromRoute('menu_test.local_action4'),
      'My dynamic-title action',
    ],
    [
      Url::fromRoute('menu_test.local_action4'),
      Html::escape("<script>alert('Welcome to the jungle!')</script>"),
    ],
    [
      Url::fromRoute('menu_test.local_action4'),
      Html::escape("<script>alert('Welcome to the derived jungle!')</script>"),
    ],
    [
      Url::fromRoute('menu_test.local_action2'),
      'My hook_menu action',
    ],
    [
      Url::fromRoute('menu_test.local_action3'),
      'My YAML discovery action',
    ],
    [
      Url::fromRoute('menu_test.local_action5'),
      'Title override',
    ],
  ]);
}