function PathValidatorTest::testGetUrlIfValidWithoutAccessCheckWithInvalidPath

Tests the getUrlIfValidWithoutAccessCheck() method with an invalid path.

@covers ::getUrlIfValidWithoutAccessCheck @covers ::getUrl

File

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

Class

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

Namespace

Drupal\Tests\Core\Path

Code

public function testGetUrlIfValidWithoutAccessCheckWithInvalidPath() : void {
    // URLs must not start nor end with ASCII control characters or spaces.
    $this->assertFalse($this->pathValidator
        ->getUrlIfValidWithoutAccessCheck('foo '));
    // Also check URL-encoded variant.
    $this->pathProcessor
        ->expects($this->once())
        ->method('processInbound')
        ->willReturnArgument(0);
    $this->assertFalse($this->pathValidator
        ->getUrlIfValidWithoutAccessCheck('foo%20'));
}

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