You are here

public function UrlTest::providerTestToUriStringForInternal in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::providerTestToUriStringForInternal()

Data provider for testing internal URIs.

File

core/tests/Drupal/Tests/Core/UrlTest.php, line 654
Contains \Drupal\Tests\Core\UrlTest.

Class

UrlTest
@coversDefaultClass \Drupal\Core\Url @group UrlTest

Namespace

Drupal\Tests\Core

Code

public function providerTestToUriStringForInternal() {
  return [
    // The four permutations of a regular path.
    [
      'internal:/test-entity/1',
      [],
      'route:entity.test_entity.canonical;test_entity=1',
    ],
    [
      'internal:/test-entity/1',
      [
        'fragment' => 'top',
      ],
      'route:entity.test_entity.canonical;test_entity=1#top',
    ],
    [
      'internal:/test-entity/1',
      [
        'fragment' => 'top',
        'query' => [
          'page' => '2',
        ],
      ],
      'route:entity.test_entity.canonical;test_entity=1?page=2#top',
    ],
    [
      'internal:/test-entity/1?page=2#top',
      [],
      'route:entity.test_entity.canonical;test_entity=1?page=2#top',
    ],
    // The four permutations of the special '<front>' path.
    [
      'internal:/',
      [],
      'route:<front>',
    ],
    [
      'internal:/',
      [
        'fragment' => 'top',
      ],
      'route:<front>#top',
    ],
    [
      'internal:/',
      [
        'fragment' => 'top',
        'query' => [
          'page' => '2',
        ],
      ],
      'route:<front>?page=2#top',
    ],
    [
      'internal:/?page=2#top',
      [],
      'route:<front>?page=2#top',
    ],
    // The four permutations of the special '<none>' path.
    [
      'internal:',
      [],
      'route:<none>',
    ],
    [
      'internal:',
      [
        'fragment' => 'top',
      ],
      'route:<none>#top',
    ],
    [
      'internal:',
      [
        'fragment' => 'top',
        'query' => [
          'page' => '2',
        ],
      ],
      'route:<none>?page=2#top',
    ],
    [
      'internal:?page=2#top',
      [],
      'route:<none>?page=2#top',
    ],
  ];
}