You are here

private function MenuTest::verifyAccess in Zircon Profile 8

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

Verifies the logged in user has the desired access to various menu pages.

Parameters

integer $response: The expected HTTP response code. Defaults to 200.

1 call to MenuTest::verifyAccess()
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 907
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

private function verifyAccess($response = 200) {

  // View menu help page.
  $this
    ->drupalGet('admin/help/menu');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Menu'), 'Menu help was displayed');
  }

  // View menu build overview page.
  $this
    ->drupalGet('admin/structure/menu');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Menus'), 'Menu build overview page was displayed');
  }

  // View tools menu customization page.
  $this
    ->drupalGet('admin/structure/menu/manage/' . $this->menu
    ->id());
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Tools'), 'Tools menu page was displayed');
  }

  // View menu edit page for a static link.
  $item = $this
    ->getStandardMenuLink();
  $this
    ->drupalGet('admin/structure/menu/link/' . $item
    ->getPluginId() . '/edit');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Edit menu item'), 'Menu edit page was displayed');
  }

  // View add menu page.
  $this
    ->drupalGet('admin/structure/menu/add');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Menus'), 'Add menu page was displayed');
  }
}