function UrlGeneratorTest::testEncodingOfChainedRelativePathSegments

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::testEncodingOfChainedRelativePathSegments()

Tests generate with chained relative path segments.

File

core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php, line 590

Class

UrlGeneratorTest
Confirm that the UrlGenerator is functioning properly.

Namespace

Drupal\Tests\Core\Routing

Code

public function testEncodingOfChainedRelativePathSegments() : void {
  $this->assertGenerateFromRoute('test_path', [
    'path' => '../../..',
  ], [], '/test-path/%2E%2E/%2E%2E/%2E%2E/bar', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));
  $this->assertGenerateFromRoute('test_path', [
    'path' => '././.',
  ], [], '/test-path/%2E/%2E/%2E/bar', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));
  $this->assertGenerateFromRoute('test_path', [
    'path' => '../././..',
  ], [], '/test-path/%2E%2E/%2E/%2E/%2E%2E/bar', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));
  $this->assertGenerateFromRoute('test_tail', [
    'path' => '../../..',
  ], [], '/test-tail/%2E%2E/%2E%2E/%2E%2E', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));
  $this->assertGenerateFromRoute('test_tail', [
    'path' => '././.',
  ], [], '/test-tail/%2E/%2E/%2E', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));
}

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