You are here

function MenuTest::addInvalidMenuLink in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/src/Tests/MenuTest.php \Drupal\menu_ui\Tests\MenuTest::addInvalidMenuLink()

Attempts to add menu link with invalid path or no access permission.

1 call to MenuTest::addInvalidMenuLink()
MenuTest::testMenu in core/modules/menu_ui/src/Tests/MenuTest.php
Tests menu functionality using the admin and user interfaces.

File

core/modules/menu_ui/src/Tests/MenuTest.php, line 642
Contains \Drupal\menu_ui\Tests\MenuTest.

Class

MenuTest
Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.

Namespace

Drupal\menu_ui\Tests

Code

function addInvalidMenuLink() {
  foreach (array(
    'access' => '/admin/people/permissions',
  ) as $type => $link_path) {
    $edit = array(
      'link[0][uri]' => $link_path,
      'title[0][value]' => 'title',
    );
    $this
      ->drupalPostForm("admin/structure/menu/manage/{$this->menu->id()}/add", $edit, t('Save'));
    $this
      ->assertRaw(t("The path '@link_path' is inaccessible.", array(
      '@link_path' => $link_path,
    )), 'Menu link was not created');
  }
}