You are here

public function PathValidatorTest::testIsValidWithFailingParameterConverting in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 216
Contains \Drupal\Tests\Core\Path\PathValidatorTest.

Class

PathValidatorTest
@coversDefaultClass \Drupal\Core\Path\PathValidator @group Routing

Namespace

Drupal\Tests\Core\Path

Code

public function testIsValidWithFailingParameterConverting() {
  $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'));
}