function PathValidatorTest::testIsValidWithNotExistingPath
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithNotExistingPath()
- 8.9.x core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithNotExistingPath()
- 11.x core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithNotExistingPath()
Tests the isValid() method with a non-existent path.
@covers ::isValid
File
-
core/
tests/ Drupal/ Tests/ Core/ Path/ PathValidatorTest.php, line 306
Class
- PathValidatorTest
- @coversDefaultClass \Drupal\Core\Path\PathValidator @group Routing
Namespace
Drupal\Tests\Core\PathCode
public function testIsValidWithNotExistingPath() : void {
$this->account
->expects($this->once())
->method('hasPermission')
->with('link to any page')
->willReturn(FALSE);
$this->accessUnawareRouter
->expects($this->never())
->method('match');
$this->accessAwareRouter
->expects($this->once())
->method('match')
->with('/not-existing-path')
->willThrowException(new ResourceNotFoundException());
$this->pathProcessor
->expects($this->once())
->method('processInbound')
->willReturnArgument(0);
$this->assertFalse($this->pathValidator
->isValid('not-existing-path'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.