function PathValidatorTest::testIsValidWithLinkToAnyPageAccount
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithLinkToAnyPageAccount()
- 10 core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithLinkToAnyPageAccount()
- 11.x core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithLinkToAnyPageAccount()
Tests the isValid() method with a 'link to any page' permission.
@covers ::isValid @covers ::getPathAttributes
File
-
core/
tests/ Drupal/ Tests/ Core/ Path/ PathValidatorTest.php, line 121
Class
- PathValidatorTest
- @coversDefaultClass \Drupal\Core\Path\PathValidator @group Routing
Namespace
Drupal\Tests\Core\PathCode
public function testIsValidWithLinkToAnyPageAccount() {
$this->account
->expects($this->once())
->method('hasPermission')
->with('link to any page')
->willReturn(TRUE);
$this->accessAwareRouter
->expects($this->never())
->method('match');
$this->accessUnawareRouter
->expects($this->once())
->method('match')
->with('/test-path')
->willReturn([
RouteObjectInterface::ROUTE_NAME => 'test_route',
'_raw_variables' => new ParameterBag([
'key' => 'value',
]),
]);
$this->pathProcessor
->expects($this->once())
->method('processInbound')
->willReturnArgument(0);
$this->assertTrue($this->pathValidator
->isValid('test-path'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.