You are here

public function MenuTest::testMenuParentsJsAccess 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::testMenuParentsJsAccess()

Tests if administrative users other than user 1 can access the menu parents AJAX callback.

File

core/modules/menu_ui/src/Tests/MenuTest.php, line 870
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

public function testMenuParentsJsAccess() {
  $admin = $this
    ->drupalCreateUser(array(
    'administer menu',
  ));
  $this
    ->drupalLogin($admin);

  // Just check access to the callback overall, the POST data is irrelevant.
  $this
    ->drupalGetAjax('admin/structure/menu/parents');
  $this
    ->assertResponse(200);

  // Do standard user tests.
  // Login the user.
  $this
    ->drupalLogin($this->authenticatedUser);
  $this
    ->drupalGetAjax('admin/structure/menu/parents');
  $this
    ->assertResponse(403);
}