function MenuUiTest::verifyAccess
Same name in other branches
- 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::verifyAccess()
- 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::verifyAccess()
- 11.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::verifyAccess()
Verifies the logged in user has the desired access to various menu pages.
Parameters
int $response: (optional) The expected HTTP response code. Defaults to 200.
1 call to MenuUiTest::verifyAccess()
- MenuUiTest::testMenuAdministration in core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php - Tests menu functionality using the admin and user interfaces.
File
-
core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php, line 1043
Class
- MenuUiTest
- Tests the menu UI.
Namespace
Drupal\Tests\menu_ui\FunctionalCode
private function verifyAccess($response = 200) {
// View menu help page.
$this->drupalGet('admin/help/menu');
$this->assertSession()
->statusCodeEquals($response);
if ($response == 200) {
$this->assertSession()
->pageTextContains('Menu', 'Menu help was displayed');
}
// View menu build overview page.
$this->drupalGet('admin/structure/menu');
$this->assertSession()
->statusCodeEquals($response);
if ($response == 200) {
$this->assertSession()
->pageTextContains('Menus', 'Menu build overview page was displayed');
}
// View tools menu customization page.
$this->drupalGet('admin/structure/menu/manage/' . $this->menu
->id());
$this->assertSession()
->statusCodeEquals($response);
if ($response == 200) {
$this->assertSession()
->pageTextContains('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->assertSession()
->statusCodeEquals($response);
if ($response == 200) {
$this->assertSession()
->pageTextContains('Edit menu item', 'Menu edit page was displayed');
}
// View add menu page.
$this->drupalGet('admin/structure/menu/add');
$this->assertSession()
->statusCodeEquals($response);
if ($response == 200) {
$this->assertSession()
->pageTextContains('Menus', 'Add menu page was displayed');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.