function MenuAccessTest::assertMenuItemRoutesAccess
Same name in other branches
- 11.x core/modules/system/tests/src/Functional/Menu/MenuAccessTest.php \Drupal\Tests\system\Functional\Menu\MenuAccessTest::assertMenuItemRoutesAccess()
Asserts route requests connected to menu items have the expected access.
Parameters
int $expected_status: The expected request status.
string|\Drupal\Core\Url ...$paths: The paths as passed to \Drupal\Tests\UiHelperTrait::drupalGet().
1 call to MenuAccessTest::assertMenuItemRoutesAccess()
- MenuAccessTest::testSystemAdminMenuBlockAccessCheck in core/
modules/ system/ tests/ src/ Functional/ Menu/ MenuAccessTest.php - Test routes implementing _access_admin_menu_block_page.
File
-
core/
modules/ system/ tests/ src/ Functional/ Menu/ MenuAccessTest.php, line 355
Class
- MenuAccessTest
- Tests the route access checks on menu links.
Namespace
Drupal\Tests\system\Functional\MenuCode
private function assertMenuItemRoutesAccess(int $expected_status, string|Url ...$paths) : void {
foreach ($paths as $path) {
$this->drupalGet($path);
if (!is_string($path)) {
$path = $path->toString();
}
// We don't use \Behat\Mink\WebAssert::statusCodeEquals() here because it
// would not allow us to know which path failed.
$this->assertSame($expected_status, $this->getSession()
->getStatusCode(), "Route {$path} has expected status code");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.