public static function UrlHelperTest::providerTestParse in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestParse()
- 10 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestParse()
Provides data for self::testParse().
Return value
array
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ UrlHelperTest.php, line 252
Class
- UrlHelperTest
- @group Utility
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerTestParse() {
return [
[
'http://www.example.com/my/path',
[
'path' => 'http://www.example.com/my/path',
'query' => [],
'fragment' => '',
],
],
[
'http://www.example.com/my/path?destination=home#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [
'destination' => 'home',
],
'fragment' => 'footer',
],
],
'absolute fragment, no query' => [
'http://www.example.com/my/path#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [],
'fragment' => 'footer',
],
],
[
'http://',
[
'path' => '',
'query' => [],
'fragment' => '',
],
],
[
'https://',
[
'path' => '',
'query' => [],
'fragment' => '',
],
],
[
'/my/path?destination=home#footer',
[
'path' => '/my/path',
'query' => [
'destination' => 'home',
],
'fragment' => 'footer',
],
],
'relative fragment, no query' => [
'/my/path#footer',
[
'path' => '/my/path',
'query' => [],
'fragment' => 'footer',
],
],
'URL with two question marks, not encoded' => [
'http://www.example.com/my/path?destination=home&search=http://www.example.com/search?limit=10#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [
'destination' => 'home',
'search' => 'http://www.example.com/search?limit=10',
],
'fragment' => 'footer',
],
],
'URL with three question marks, not encoded' => [
'http://www.example.com/my/path?destination=home&search=http://www.example.com/search?limit=10&referer=http://www.example.com/my/path?destination=home&other#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [
'destination' => 'home',
'search' => 'http://www.example.com/search?limit=10',
'referer' => 'http://www.example.com/my/path?destination=home',
'other' => '',
],
'fragment' => 'footer',
],
],
'URL with three question marks, encoded' => [
'http://www.example.com/my/path?destination=home&search=http://www.example.com/search?limit=10&referer=http%3A%2F%2Fwww.example.com%2Fmy%2Fpath%3Fdestination%3Dhome%26other#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [
'destination' => 'home',
'search' => 'http://www.example.com/search?limit=10',
'referer' => 'http://www.example.com/my/path?destination=home&other',
],
'fragment' => 'footer',
],
],
];
}