function PathValidatorTest::testIsValidWithFailingParameterConverting

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithFailingParameterConverting()
  2. 8.9.x core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithFailingParameterConverting()
  3. 10 core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php \Drupal\Tests\Core\Path\PathValidatorTest::testIsValidWithFailingParameterConverting()

Tests the isValid() method with a not working param converting.

@covers ::isValid

File

core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php, line 283

Class

PathValidatorTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Path%21PathValidator.php/class/PathValidator/11.x" title="Provides a default path validator and access checker." class="local">\Drupal\Core\Path\PathValidator</a> @group Routing

Namespace

Drupal\Tests\Core\Path

Code

public function testIsValidWithFailingParameterConverting() : 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('/entity-test/1')
        ->willThrowException(new ParamNotConvertedException());
    $this->pathProcessor
        ->expects($this->once())
        ->method('processInbound')
        ->willReturnArgument(0);
    $this->assertFalse($this->pathValidator
        ->isValid('entity-test/1'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.