public function PathValidatorTest::testGetUrlIfValidWithoutAccess in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testGetUrlIfValidWithoutAccess()
Tests the getUrlIfValid() method where there is no access.
@covers ::getUrlIfValid
File
- core/
tests/ Drupal/ Tests/ Core/ Path/ PathValidatorTest.php, line 387
Class
- PathValidatorTest
- @coversDefaultClass \Drupal\Core\Path\PathValidator @group Routing
Namespace
Drupal\Tests\Core\PathCode
public function testGetUrlIfValidWithoutAccess() {
$this->account
->expects($this
->once())
->method('hasPermission')
->with('link to any page')
->willReturn(FALSE);
$this->accessAwareRouter
->expects($this
->once())
->method('match')
->with('/test-path')
->willThrowException(new AccessDeniedHttpException());
$this->pathProcessor
->expects($this
->once())
->method('processInbound')
->willReturnArgument(0);
$url = $this->pathValidator
->getUrlIfValid('test-path');
$this
->assertFalse($url);
}