| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152 | 
							- <?php
 
- use Codeception\Util\Fixtures;
 
- use Grav\Common\Grav;
 
- use Grav\Common\Uri;
 
- use Grav\Common\Utils;
 
- /**
 
-  * Class UriTest
 
-  */
 
- class UriTest extends \Codeception\TestCase\Test
 
- {
 
-     /** @var Grav $grav */
 
-     protected $grav;
 
-     /** @var Uri $uri */
 
-     protected $uri;
 
-     protected $tests = [
 
-         '/path' => [
 
-             'scheme' => '',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => null,
 
-             'port' => null,
 
-             'path' => '/path',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/path',
 
-             'paths' => ['path'],
 
-             'params' => null,
 
-             'url' => '/path',
 
-             'environment' => 'unknown',
 
-             'basename' => 'path',
 
-             'base' => '',
 
-             'currentPage' => 1,
 
-             'rootUrl' => '',
 
-             'extension' => null,
 
-             'addNonce' => '/path/nonce:{{nonce}}',
 
-         ],
 
-         '//localhost/' => [
 
-             'scheme' => '//',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => null,
 
-             'path' => '/',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/',
 
-             'paths' => [],
 
-             'params' => null,
 
-             'url' => '/',
 
-             'environment' => 'localhost',
 
-             'basename' => '',
 
-             'base' => '//localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => '//localhost',
 
-             'extension' => null,
 
-             'addNonce' => '//localhost/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost/' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/',
 
-             'paths' => [],
 
-             'params' => null,
 
-             'url' => '/',
 
-             'environment' => 'localhost',
 
-             'basename' => '',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/nonce:{{nonce}}',
 
-         ],
 
-         'http://127.0.0.1/' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => '127.0.0.1',
 
-             'port' => 80,
 
-             'path' => '/',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/',
 
-             'paths' => [],
 
-             'params' => null,
 
-             'url' => '/',
 
-             'environment' => 'localhost',
 
-             'basename' => '',
 
-             'base' => 'http://127.0.0.1',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://127.0.0.1',
 
-             'extension' => null,
 
-             'addNonce' => 'http://127.0.0.1/nonce:{{nonce}}',
 
-         ],
 
-         'https://localhost/' => [
 
-             'scheme' => 'https://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 443,
 
-             'path' => '/',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/',
 
-             'paths' => [],
 
-             'params' => null,
 
-             'url' => '/',
 
-             'environment' => 'localhost',
 
-             'basename' => '',
 
-             'base' => 'https://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'https://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'https://localhost/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost:8080/grav/it/ueper' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/grav/it/ueper/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost:8080/grav/it/ueper:xxx' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/grav/it',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/grav/it',
 
-             'paths' => ['grav', 'it'],
 
-             'params' => '/ueper:xxx',
 
-             'url' => '/grav/it',
 
-             'environment' => 'localhost',
 
-             'basename' => 'it',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/grav/it/ueper:xxx/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost:8080/grav/it/ueper:xxx/page:/test:yyy' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/grav/it',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/grav/it',
 
-             'paths' => ['grav', 'it'],
 
-             'params' => '/ueper:xxx/page:/test:yyy',
 
-             'url' => '/grav/it',
 
-             'environment' => 'localhost',
 
-             'basename' => 'it',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/grav/it/ueper:xxx/page:/test:yyy/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost:8080/grav/it/ueper?test=x' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => 'test=x',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/grav/it/ueper/nonce:{{nonce}}?test=x',
 
-         ],
 
-         'http://localhost:80/grav/it/ueper?test=x' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => 'test=x',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://localhost:80',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:80',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:80/grav/it/ueper/nonce:{{nonce}}?test=x',
 
-         ],
 
-         'http://localhost/grav/it/ueper?test=x' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => 'test=x',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/grav/it/ueper/nonce:{{nonce}}?test=x',
 
-         ],
 
-         'http://grav/grav/it/ueper' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'grav',
 
-             'port' => 80,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'grav',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://grav',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://grav',
 
-             'extension' => null,
 
-             'addNonce' => 'http://grav/grav/it/ueper/nonce:{{nonce}}',
 
-         ],
 
-         'https://username:password@api.getgrav.com:4040/v1/post/128/page:x/?all=1' => [
 
-             'scheme' => 'https://',
 
-             'user' => 'username',
 
-             'password' => 'password',
 
-             'host' => 'api.getgrav.com',
 
-             'port' => 4040,
 
-             'path' => '/v1/post/128/', // FIXME <-
 
-             'query' => 'all=1',
 
-             'fragment' => null,
 
-             'route' => '/v1/post/128',
 
-             'paths' => ['v1', 'post', '128'],
 
-             'params' => '/page:x',
 
-             'url' => '/v1/post/128',
 
-             'environment' => 'api.getgrav.com',
 
-             'basename' => '128',
 
-             'base' => 'https://api.getgrav.com:4040',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'https://api.getgrav.com:4040',
 
-             'extension' => null,
 
-             'addNonce' => 'https://username:password@api.getgrav.com:4040/v1/post/128/page:x/nonce:{{nonce}}?all=1',
 
-             'toOriginalString' => 'https://username:password@api.getgrav.com:4040/v1/post/128/page:x?all=1'
 
-         ],
 
-         'https://google.com:443/' => [
 
-             'scheme' => 'https://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'google.com',
 
-             'port' => 443,
 
-             'path' => '/',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/',
 
-             'paths' => [],
 
-             'params' => null,
 
-             'url' => '/',
 
-             'environment' => 'google.com',
 
-             'basename' => '',
 
-             'base' => 'https://google.com:443',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'https://google.com:443',
 
-             'extension' => null,
 
-             'addNonce' => 'https://google.com:443/nonce:{{nonce}}',
 
-         ],
 
-         // Path tests.
 
-         'http://localhost:8080/a/b/c/d' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/a/b/c/d',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a/b/c/d',
 
-             'paths' => ['a', 'b', 'c', 'd'],
 
-             'params' => null,
 
-             'url' => '/a/b/c/d',
 
-             'environment' => 'localhost',
 
-             'basename' => 'd',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/a/b/c/d/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f',
 
-             'paths' => ['a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c', 'd', 'e', 'f'],
 
-             'params' => null,
 
-             'url' => '/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f',
 
-             'environment' => 'localhost',
 
-             'basename' => 'f',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost/this is the path/my page' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/this%20is%20the%20path/my%20page',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/this%20is%20the%20path/my%20page',
 
-             'paths' => ['this%20is%20the%20path', 'my%20page'],
 
-             'params' => null,
 
-             'url' => '/this%20is%20the%20path/my%20page',
 
-             'environment' => 'localhost',
 
-             'basename' => 'my%20page',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/this%20is%20the%20path/my%20page/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/this%20is%20the%20path/my%20page'
 
-         ],
 
-         'http://localhost/pölöpölö/päläpälä' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/p%C3%B6l%C3%B6p%C3%B6l%C3%B6/p%C3%A4l%C3%A4p%C3%A4l%C3%A4',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/p%C3%B6l%C3%B6p%C3%B6l%C3%B6/p%C3%A4l%C3%A4p%C3%A4l%C3%A4',
 
-             'paths' => ['p%C3%B6l%C3%B6p%C3%B6l%C3%B6', 'p%C3%A4l%C3%A4p%C3%A4l%C3%A4'],
 
-             'params' => null,
 
-             'url' => '/p%C3%B6l%C3%B6p%C3%B6l%C3%B6/p%C3%A4l%C3%A4p%C3%A4l%C3%A4',
 
-             'environment' => 'localhost',
 
-             'basename' => 'p%C3%A4l%C3%A4p%C3%A4l%C3%A4',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/p%C3%B6l%C3%B6p%C3%B6l%C3%B6/p%C3%A4l%C3%A4p%C3%A4l%C3%A4/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/p%C3%B6l%C3%B6p%C3%B6l%C3%B6/p%C3%A4l%C3%A4p%C3%A4l%C3%A4'
 
-         ],
 
-         // Query params tests.
 
-         'http://localhost:8080/grav/it/ueper?test=x&test2=y' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => 'test=x&test2=y',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/grav/it/ueper/nonce:{{nonce}}?test=x&test2=y',
 
-         ],
 
-         'http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => 'test=x&test2=y&test3=x&test4=y',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/grav/it/ueper/nonce:{{nonce}}?test=x&test2=y&test3=x&test4=y',
 
-         ],
 
-         'http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/grav/it/ueper',
 
-             'query' => 'test=x&test2=y&test3=x&test4=y%2Ftest',
 
-             'fragment' => null,
 
-             'route' => '/grav/it/ueper',
 
-             'paths' => ['grav', 'it', 'ueper'],
 
-             'params' => null,
 
-             'url' => '/grav/it/ueper',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ueper',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/grav/it/ueper/nonce:{{nonce}}?test=x&test2=y&test3=x&test4=y/test',
 
-         ],
 
-         // Port tests.
 
-         'http://localhost/a-page' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/a-page',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a-page',
 
-             'paths' => ['a-page'],
 
-             'params' => null,
 
-             'url' => '/a-page',
 
-             'environment' => 'localhost',
 
-             'basename' => 'a-page',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/a-page/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost:8080/a-page' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/a-page',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a-page',
 
-             'paths' => ['a-page'],
 
-             'params' => null,
 
-             'url' => '/a-page',
 
-             'environment' => 'localhost',
 
-             'basename' => 'a-page',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/a-page/nonce:{{nonce}}',
 
-         ],
 
-         'http://localhost:443/a-page' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 443,
 
-             'path' => '/a-page',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a-page',
 
-             'paths' => ['a-page'],
 
-             'params' => null,
 
-             'url' => '/a-page',
 
-             'environment' => 'localhost',
 
-             'basename' => 'a-page',
 
-             'base' => 'http://localhost:443',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:443',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:443/a-page/nonce:{{nonce}}',
 
-         ],
 
-         // Extension tests.
 
-         'http://localhost/a-page.html' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/a-page',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a-page',
 
-             'paths' => ['a-page'],
 
-             'params' => null,
 
-             'url' => '/a-page',
 
-             'environment' => 'localhost',
 
-             'basename' => 'a-page.html',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => 'html',
 
-             'addNonce' => 'http://localhost/a-page.html/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/a-page.html',
 
-         ],
 
-         'http://localhost/a-page.json' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/a-page',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a-page',
 
-             'paths' => ['a-page'],
 
-             'params' => null,
 
-             'url' => '/a-page',
 
-             'environment' => 'localhost',
 
-             'basename' => 'a-page.json',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => 'json',
 
-             'addNonce' => 'http://localhost/a-page.json/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/a-page.json',
 
-         ],
 
-         'http://localhost/admin/ajax.json/task:getnewsfeed' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/admin/ajax',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/admin/ajax',
 
-             'paths' => ['admin', 'ajax'],
 
-             'params' => '/task:getnewsfeed',
 
-             'url' => '/admin/ajax',
 
-             'environment' => 'localhost',
 
-             'basename' => 'ajax.json',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => 'json',
 
-             'addNonce' => 'http://localhost/admin/ajax.json/task:getnewsfeed/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/admin/ajax.json/task:getnewsfeed',
 
-         ],
 
-         'http://localhost/grav/admin/media.json/route:L1VzZXJzL3JodWsvd29ya3NwYWNlL2dyYXYtZGVtby1zYW1wbGVyL3VzZXIvYXNzZXRzL3FRMXB4Vk1ERTNJZzh5Ni5qcGc=/task:removeFileFromBlueprint/proute:/blueprint:Y29uZmlnL2RldGFpbHM=/type:config/field:deep.nested.custom_file/path:dXNlci9hc3NldHMvcVExcHhWTURFM0lnOHk2LmpwZw==' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/grav/admin/media',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/grav/admin/media',
 
-             'paths' => ['grav','admin','media'],
 
-             'params' => '/route:L1VzZXJzL3JodWsvd29ya3NwYWNlL2dyYXYtZGVtby1zYW1wbGVyL3VzZXIvYXNzZXRzL3FRMXB4Vk1ERTNJZzh5Ni5qcGc=/task:removeFileFromBlueprint/proute:/blueprint:Y29uZmlnL2RldGFpbHM=/type:config/field:deep.nested.custom_file/path:dXNlci9hc3NldHMvcVExcHhWTURFM0lnOHk2LmpwZw==',
 
-             'url' => '/grav/admin/media',
 
-             'environment' => 'localhost',
 
-             'basename' => 'media.json',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => 'json',
 
-             'addNonce' => 'http://localhost/grav/admin/media.json/route:L1VzZXJzL3JodWsvd29ya3NwYWNlL2dyYXYtZGVtby1zYW1wbGVyL3VzZXIvYXNzZXRzL3FRMXB4Vk1ERTNJZzh5Ni5qcGc=/task:removeFileFromBlueprint/proute:/blueprint:Y29uZmlnL2RldGFpbHM=/type:config/field:deep.nested.custom_file/path:dXNlci9hc3NldHMvcVExcHhWTURFM0lnOHk2LmpwZw==/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/grav/admin/media.json/route:L1VzZXJzL3JodWsvd29ya3NwYWNlL2dyYXYtZGVtby1zYW1wbGVyL3VzZXIvYXNzZXRzL3FRMXB4Vk1ERTNJZzh5Ni5qcGc=/task:removeFileFromBlueprint/proute:/blueprint:Y29uZmlnL2RldGFpbHM=/type:config/field:deep.nested.custom_file/path:dXNlci9hc3NldHMvcVExcHhWTURFM0lnOHk2LmpwZw==',
 
-         ],
 
-         'http://localhost/a-page.foo' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/a-page.foo',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/a-page.foo',
 
-             'paths' => ['a-page.foo'],
 
-             'params' => null,
 
-             'url' => '/a-page.foo',
 
-             'environment' => 'localhost',
 
-             'basename' => 'a-page.foo',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => 'foo',
 
-             'addNonce' => 'http://localhost/a-page.foo/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/a-page.foo'
 
-         ],
 
-         // Fragment tests.
 
-         'http://localhost:8080/a/b/c#my-fragment' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 8080,
 
-             'path' => '/a/b/c',
 
-             'query' => '',
 
-             'fragment' => 'my-fragment',
 
-             'route' => '/a/b/c',
 
-             'paths' => ['a', 'b', 'c'],
 
-             'params' => null,
 
-             'url' => '/a/b/c',
 
-             'environment' => 'localhost',
 
-             'basename' => 'c',
 
-             'base' => 'http://localhost:8080',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost:8080',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost:8080/a/b/c/nonce:{{nonce}}#my-fragment',
 
-         ],
 
-         // Attacks.
 
-         '"><script>alert</script>://localhost' => [
 
-             'scheme' => '',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => null,
 
-             'port' => null,
 
-             'path' => '%22%3E%3Cscript%3Ealert%3C/localhost',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/%22%3E%3Cscript%3Ealert%3C/localhost',
 
-             'paths' => ['%22%3E%3Cscript%3Ealert%3C', 'localhost'],
 
-             'params' => '/script%3E:',
 
-             'url' => '%22%3E%3Cscript%3Ealert%3C//localhost',
 
-             'environment' => 'unknown',
 
-             'basename' => 'localhost',
 
-             'base' => '',
 
-             'currentPage' => 1,
 
-             'rootUrl' => '',
 
-             'extension' => null,
 
-             //'addNonce' => '%22%3E%3Cscript%3Ealert%3C/localhost/script%3E:/nonce:{{nonce}}', // FIXME <-
 
-             'toOriginalString' => '%22%3E%3Cscript%3Ealert%3C/localhost/script%3E:' // FIXME <-
 
-         ],
 
-         'http://"><script>alert</script>' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'unknown',
 
-             'port' => 80,
 
-             'path' => '/script%3E',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/script%3E',
 
-             'paths' => ['script%3E'],
 
-             'params' => null,
 
-             'url' => '/script%3E',
 
-             'environment' => 'unknown',
 
-             'basename' => 'script%3E',
 
-             'base' => 'http://unknown',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://unknown',
 
-             'extension' => null,
 
-             'addNonce' => 'http://unknown/script%3E/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://unknown/script%3E'
 
-         ],
 
-         'http://localhost/"><script>alert</script>' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/%22%3E%3Cscript%3Ealert%3C/script%3E',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/%22%3E%3Cscript%3Ealert%3C/script%3E',
 
-             'paths' => ['%22%3E%3Cscript%3Ealert%3C', 'script%3E'],
 
-             'params' => null,
 
-             'url' => '/%22%3E%3Cscript%3Ealert%3C/script%3E',
 
-             'environment' => 'localhost',
 
-             'basename' => 'script%3E',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/%22%3E%3Cscript%3Ealert%3C/script%3E/nonce:{{nonce}}',
 
-             'toOriginalString' => 'http://localhost/%22%3E%3Cscript%3Ealert%3C/script%3E'
 
-         ],
 
-         'http://localhost/something/p1:foo/p2:"><script>alert</script>' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/something/script%3E',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/something/script%3E',
 
-             'paths' => ['something', 'script%3E'],
 
-             'params' => '/p1:foo/p2:%22%3E%3Cscript%3Ealert%3C',
 
-             'url' => '/something/script%3E',
 
-             'environment' => 'localhost',
 
-             'basename' => 'script%3E',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             //'addNonce' => 'http://localhost/something/script%3E/p1:foo/p2:%22%3E%3Cscript%3Ealert%3C/nonce:{{nonce}}', // FIXME <-
 
-             'toOriginalString' => 'http://localhost/something/script%3E/p1:foo/p2:%22%3E%3Cscript%3Ealert%3C'
 
-         ],
 
-         'http://localhost/something?p="><script>alert</script>' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/something',
 
-             'query' => 'p=%22%3E%3Cscript%3Ealert%3C%2Fscript%3E',
 
-             'fragment' => null,
 
-             'route' => '/something',
 
-             'paths' => ['something'],
 
-             'params' => null,
 
-             'url' => '/something',
 
-             'environment' => 'localhost',
 
-             'basename' => 'something',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/something/nonce:{{nonce}}?p=%22%3E%3Cscript%3Ealert%3C/script%3E',
 
-             'toOriginalString' => 'http://localhost/something?p=%22%3E%3Cscript%3Ealert%3C/script%3E'
 
-         ],
 
-         'http://localhost/something#"><script>alert</script>' => [
 
-             'scheme' => 'http://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'localhost',
 
-             'port' => 80,
 
-             'path' => '/something',
 
-             'query' => '',
 
-             'fragment' => '%22%3E%3Cscript%3Ealert%3C/script%3E',
 
-             'route' => '/something',
 
-             'paths' => ['something'],
 
-             'params' => null,
 
-             'url' => '/something',
 
-             'environment' => 'localhost',
 
-             'basename' => 'something',
 
-             'base' => 'http://localhost',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'http://localhost',
 
-             'extension' => null,
 
-             'addNonce' => 'http://localhost/something/nonce:{{nonce}}#%22%3E%3Cscript%3Ealert%3C/script%3E',
 
-             'toOriginalString' => 'http://localhost/something#%22%3E%3Cscript%3Ealert%3C/script%3E'
 
-         ],
 
-         'https://www.getgrav.org/something/"><script>eval(atob("aGlzdG9yeS5wdXNoU3RhdGUoJycsJycsJy8nKTskKCdoZWFkLGJvZHknKS5odG1sKCcnKS5sb2FkKCcvJyk7JC5wb3N0KCcvYWRtaW4nLGZ1bmN0aW9uKGRhdGEpeyQucG9zdCgkKGRhdGEpLmZpbmQoJ1tpZD1hZG1pbi11c2VyLWRldGFpbHNdIGEnKS5hdHRyKCdocmVmJykseydhZG1pbi1ub25jZSc6JChkYXRhKS5maW5kKCdbZGF0YS1jbGVhci1jYWNoZV0nKS5hdHRyKCdkYXRhLWNsZWFyLWNhY2hlJykuc3BsaXQoJzonKS5wb3AoKS50cmltKCksJ2RhdGFbcGFzc3dvcmRdJzonSW0zdjFsaDR4eDByJywndGFzayc6J3NhdmUnfSl9KQ=="))</script><' => [
 
-             'scheme' => 'https://',
 
-             'user' => null,
 
-             'password' => null,
 
-             'host' => 'www.getgrav.org',
 
-             'port' => 443,
 
-             'path' => '/something/%22%3E%3Cscript%3Eeval%28atob%28%22aGlzdG9yeS5wdXNoU3RhdGUoJycsJycsJy8nKTskKCdoZWFkLGJvZHknKS5odG1sKCcnKS5sb2FkKCcvJyk7JC5wb3N0KCcvYWRtaW4nLGZ1bmN0aW9uKGRhdGEpeyQucG9zdCgkKGRhdGEpLmZpbmQoJ1tpZD1hZG1pbi11c2VyLWRldGFpbHNdIGEnKS5hdHRyKCdocmVmJykseydhZG1pbi1ub25jZSc6JChkYXRhKS5maW5kKCdbZGF0YS1jbGVhci1jYWNoZV0nKS5hdHRyKCdkYXRhLWNsZWFyLWNhY2hlJykuc3BsaXQoJzonKS5wb3AoKS50cmltKCksJ2RhdGFbcGFzc3dvcmRdJzonSW0zdjFsaDR4eDByJywndGFzayc6J3NhdmUnfSl9KQ==%22%29%29%3C/script%3E%3C',
 
-             'query' => '',
 
-             'fragment' => null,
 
-             'route' => '/something/%22%3E%3Cscript%3Eeval%28atob%28%22aGlzdG9yeS5wdXNoU3RhdGUoJycsJycsJy8nKTskKCdoZWFkLGJvZHknKS5odG1sKCcnKS5sb2FkKCcvJyk7JC5wb3N0KCcvYWRtaW4nLGZ1bmN0aW9uKGRhdGEpeyQucG9zdCgkKGRhdGEpLmZpbmQoJ1tpZD1hZG1pbi11c2VyLWRldGFpbHNdIGEnKS5hdHRyKCdocmVmJykseydhZG1pbi1ub25jZSc6JChkYXRhKS5maW5kKCdbZGF0YS1jbGVhci1jYWNoZV0nKS5hdHRyKCdkYXRhLWNsZWFyLWNhY2hlJykuc3BsaXQoJzonKS5wb3AoKS50cmltKCksJ2RhdGFbcGFzc3dvcmRdJzonSW0zdjFsaDR4eDByJywndGFzayc6J3NhdmUnfSl9KQ==%22%29%29%3C/script%3E%3C',
 
-             'paths' => ['something', '%22%3E%3Cscript%3Eeval%28atob%28%22aGlzdG9yeS5wdXNoU3RhdGUoJycsJycsJy8nKTskKCdoZWFkLGJvZHknKS5odG1sKCcnKS5sb2FkKCcvJyk7JC5wb3N0KCcvYWRtaW4nLGZ1bmN0aW9uKGRhdGEpeyQucG9zdCgkKGRhdGEpLmZpbmQoJ1tpZD1hZG1pbi11c2VyLWRldGFpbHNdIGEnKS5hdHRyKCdocmVmJykseydhZG1pbi1ub25jZSc6JChkYXRhKS5maW5kKCdbZGF0YS1jbGVhci1jYWNoZV0nKS5hdHRyKCdkYXRhLWNsZWFyLWNhY2hlJykuc3BsaXQoJzonKS5wb3AoKS50cmltKCksJ2RhdGFbcGFzc3dvcmRdJzonSW0zdjFsaDR4eDByJywndGFzayc6J3NhdmUnfSl9KQ==%22%29%29%3C', 'script%3E%3C'],
 
-             'params' => null,
 
-             'url' => '/something/%22%3E%3Cscript%3Eeval%28atob%28%22aGlzdG9yeS5wdXNoU3RhdGUoJycsJycsJy8nKTskKCdoZWFkLGJvZHknKS5odG1sKCcnKS5sb2FkKCcvJyk7JC5wb3N0KCcvYWRtaW4nLGZ1bmN0aW9uKGRhdGEpeyQucG9zdCgkKGRhdGEpLmZpbmQoJ1tpZD1hZG1pbi11c2VyLWRldGFpbHNdIGEnKS5hdHRyKCdocmVmJykseydhZG1pbi1ub25jZSc6JChkYXRhKS5maW5kKCdbZGF0YS1jbGVhci1jYWNoZV0nKS5hdHRyKCdkYXRhLWNsZWFyLWNhY2hlJykuc3BsaXQoJzonKS5wb3AoKS50cmltKCksJ2RhdGFbcGFzc3dvcmRdJzonSW0zdjFsaDR4eDByJywndGFzayc6J3NhdmUnfSl9KQ==%22%29%29%3C/script%3E%3C',
 
-             'environment' => 'www.getgrav.org',
 
-             'basename' => 'script%3E%3C',
 
-             'base' => 'https://www.getgrav.org',
 
-             'currentPage' => 1,
 
-             'rootUrl' => 'https://www.getgrav.org',
 
-             'extension' => null,
 
-             'addNonce' => 'https://www.getgrav.org/something/%22%3E%3Cscript%3Eeval%28atob%28%22aGlzdG9yeS5wdXNoU3RhdGUoJycsJycsJy8nKTskKCdoZWFkLGJvZHknKS5odG1sKCcnKS5sb2FkKCcvJyk7JC5wb3N0KCcvYWRtaW4nLGZ1bmN0aW9uKGRhdGEpeyQucG9zdCgkKGRhdGEpLmZpbmQoJ1tpZD1hZG1pbi11c2VyLWRldGFpbHNdIGEnKS5hdHRyKCdocmVmJykseydhZG1pbi1ub25jZSc6JChkYXRhKS5maW5kKCdbZGF0YS1jbGVhci1jYWNoZV0nKS5hdHRyKCdkYXRhLWNsZWFyLWNhY2hlJykuc3BsaXQoJzonKS5wb3AoKS50cmltKCksJ2RhdGFbcGFzc3dvcmRdJzonSW0zdjFsaDR4eDByJywndGFzayc6J3NhdmUnfSl9KQ==%22%29%29%3C/script%3E%3C/nonce:{{nonce}}',
 
-             'toOriginalString' => 'https://www.getgrav.org/something/%22%3E%3Cscript%3Eeval%28atob%28%22aGlzdG9yeS5wdXNoU3RhdGUoJycsJycsJy8nKTskKCdoZWFkLGJvZHknKS5odG1sKCcnKS5sb2FkKCcvJyk7JC5wb3N0KCcvYWRtaW4nLGZ1bmN0aW9uKGRhdGEpeyQucG9zdCgkKGRhdGEpLmZpbmQoJ1tpZD1hZG1pbi11c2VyLWRldGFpbHNdIGEnKS5hdHRyKCdocmVmJykseydhZG1pbi1ub25jZSc6JChkYXRhKS5maW5kKCdbZGF0YS1jbGVhci1jYWNoZV0nKS5hdHRyKCdkYXRhLWNsZWFyLWNhY2hlJykuc3BsaXQoJzonKS5wb3AoKS50cmltKCksJ2RhdGFbcGFzc3dvcmRdJzonSW0zdjFsaDR4eDByJywndGFzayc6J3NhdmUnfSl9KQ==%22%29%29%3C/script%3E%3C'
 
-         ],
 
-     ];
 
-     protected function _before(): void
 
-     {
 
-         $grav = Fixtures::get('grav');
 
-         $this->grav = $grav();
 
-         $this->uri = $this->grav['uri'];
 
-     }
 
-     protected function _after(): void
 
-     {
 
-     }
 
-     protected function runTestSet(array $tests, $method, $params = []): void
 
-     {
 
-         foreach ($tests as $url => $candidates) {
 
-             if (!array_key_exists($method, $candidates) && $method !== 'toOriginalString') {
 
-                 continue;
 
-             }
 
-             if ($method === 'addNonce') {
 
-                 $nonce = Utils::getNonce('test-action');
 
-                 $expected = str_replace('{{nonce}}', $nonce, $candidates[$method]);
 
-                 self::assertSame($expected, Uri::addNonce($url, 'test-action'));
 
-                 continue;
 
-             }
 
-             $this->uri->initializeWithURL($url)->init();
 
-             if ($method === 'toOriginalString' && !isset($candidates[$method])) {
 
-                 $expected = $url;
 
-             } else {
 
-                 $expected = $candidates[$method];
 
-             }
 
-             if ($params) {
 
-                 $result = call_user_func_array([$this->uri, $method], $params);
 
-             } else {
 
-                 $result = $this->uri->{$method}();
 
-             }
 
-             self::assertSame($expected, $result, "Test \$url->{$method}() for {$url}");
 
-             // Deal with $url->query($key)
 
-             if ($method === 'query') {
 
-                 parse_str($expected, $queryParams);
 
-                 foreach ($queryParams as $key => $value) {
 
-                     self::assertSame($value, $this->uri->{$method}($key), "Test \$url->{$method}('{$key}') for {$url}");
 
-                 }
 
-                 self::assertNull($this->uri->{$method}('non-existing'), "Test \$url->{$method}('non-existing') for {$url}");
 
-             }
 
-         }
 
-     }
 
-     public function testValidatingHostname(): void
 
-     {
 
-         self::assertTrue($this->uri->validateHostname('localhost'));
 
-         self::assertTrue($this->uri->validateHostname('google.com'));
 
-         self::assertTrue($this->uri->validateHostname('google.it'));
 
-         self::assertTrue($this->uri->validateHostname('goog.le'));
 
-         self::assertTrue($this->uri->validateHostname('goog.wine'));
 
-         self::assertTrue($this->uri->validateHostname('goog.localhost'));
 
-         self::assertFalse($this->uri->validateHostname('localhost:80'));
 
-         self::assertFalse($this->uri->validateHostname('http://localhost'));
 
-         self::assertFalse($this->uri->validateHostname('localhost!'));
 
-     }
 
-     public function testToString(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'toOriginalString');
 
-     }
 
-     public function testScheme(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'scheme');
 
-     }
 
-     public function testUser(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'user');
 
-     }
 
-     public function testPassword(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'password');
 
-     }
 
-     public function testHost(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'host');
 
-     }
 
-     public function testPort(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'port');
 
-     }
 
-     public function testPath(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'path');
 
-     }
 
-     public function testQuery(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'query');
 
-     }
 
-     public function testFragment(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'fragment');
 
-         $this->uri->fragment('something-new');
 
-         self::assertSame('something-new', $this->uri->fragment());
 
-     }
 
-     public function testPaths(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'paths');
 
-     }
 
-     public function testRoute(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'route');
 
-     }
 
-     public function testParams(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'params');
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
 
-         self::assertSame('/ueper:xxx', $this->uri->params('ueper'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
 
-         self::assertSame('/ueper:xxx', $this->uri->params('ueper'));
 
-         self::assertSame('/test:yyy', $this->uri->params('test'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yyy')->init();
 
-         self::assertSame('/ueper:xxx++/test:yyy', $this->uri->params());
 
-         self::assertSame('/ueper:xxx++', $this->uri->params('ueper'));
 
-         self::assertSame('/test:yyy', $this->uri->params('test'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yyy#something')->init();
 
-         self::assertSame('/ueper:xxx++/test:yyy', $this->uri->params());
 
-         self::assertSame('/ueper:xxx++', $this->uri->params('ueper'));
 
-         self::assertSame('/test:yyy', $this->uri->params('test'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yyy?foo=bar')->init();
 
-         self::assertSame('/ueper:xxx++/test:yyy', $this->uri->params());
 
-         self::assertSame('/ueper:xxx++', $this->uri->params('ueper'));
 
-         self::assertSame('/test:yyy', $this->uri->params('test'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
 
-         self::assertNull($this->uri->params());
 
-         self::assertNull($this->uri->params('ueper'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
 
-         self::assertNull($this->uri->params());
 
-         self::assertNull($this->uri->params('ueper'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
 
-         self::assertNull($this->uri->params());
 
-         self::assertNull($this->uri->params('ueper'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
 
-         self::assertNull($this->uri->params());
 
-         self::assertNull($this->uri->params('ueper'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
 
-         self::assertNull($this->uri->params());
 
-         self::assertNull($this->uri->params('ueper'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
 
-         self::assertNull($this->uri->params());
 
-         self::assertNull($this->uri->params('ueper'));
 
-     }
 
-     public function testParam(): void
 
-     {
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
 
-         self::assertSame('xxx', $this->uri->param('ueper'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
 
-         self::assertSame('xxx', $this->uri->param('ueper'));
 
-         self::assertSame('yyy', $this->uri->param('test'));
 
-         $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yy%20y/foo:bar_baz-bank')->init();
 
-         self::assertSame('xxx++', $this->uri->param('ueper'));
 
-         self::assertSame('yy y', $this->uri->param('test'));
 
-         self::assertSame('bar_baz-bank', $this->uri->param('foo'));
 
-     }
 
-     public function testUrl(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'url');
 
-     }
 
-     public function testExtension(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'extension');
 
-         $this->uri->initializeWithURL('http://localhost/a-page')->init();
 
-         self::assertSame('x', $this->uri->extension('x'));
 
-     }
 
-     public function testEnvironment(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'environment');
 
-     }
 
-     public function testBasename(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'basename');
 
-     }
 
-     public function testBase(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'base');
 
-     }
 
-     public function testRootUrl(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'rootUrl', [true]);
 
-         $this->uri->initializeWithUrlAndRootPath('https://localhost/grav/page-foo', '/grav')->init();
 
-         self::assertSame('/grav', $this->uri->rootUrl());
 
-         self::assertSame('https://localhost/grav', $this->uri->rootUrl(true));
 
-     }
 
-     public function testCurrentPage(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'currentPage');
 
-         $this->uri->initializeWithURL('http://localhost:8080/a-page/page:2')->init();
 
-         self::assertSame(2, $this->uri->currentPage());
 
-     }
 
-     public function testReferrer(): void
 
-     {
 
-         $this->uri->initializeWithURL('http://localhost/foo/page:test')->init();
 
-         self::assertSame('/foo', $this->uri->referrer());
 
-         $this->uri->initializeWithURL('http://localhost/foo/bar/page:test')->init();
 
-         self::assertSame('/foo/bar', $this->uri->referrer());
 
-     }
 
-     public function testIp(): void
 
-     {
 
-         $this->uri->initializeWithURL('http://localhost/foo/page:test')->init();
 
-         self::assertSame('UNKNOWN', Uri::ip());
 
-     }
 
-     public function testIsExternal(): void
 
-     {
 
-         $this->uri->initializeWithURL('http://localhost/')->init();
 
-         self::assertFalse(Uri::isExternal('/test'));
 
-         self::assertFalse(Uri::isExternal('/foo/bar'));
 
-         self::assertTrue(Uri::isExternal('http://localhost/test'));
 
-         self::assertTrue(Uri::isExternal('http://google.it/test'));
 
-     }
 
-     public function testBuildUrl(): void
 
-     {
 
-         $parsed_url = [
 
-             'scheme' => 'http',
 
-             'host'   => 'localhost',
 
-             'port'   => 8080,
 
-         ];
 
-         self::assertSame('http://localhost:8080', Uri::buildUrl($parsed_url));
 
-         $parsed_url = [
 
-             'scheme'   => 'http',
 
-             'host'     => 'localhost',
 
-             'port'     => 8080,
 
-             'user'     => 'foo',
 
-             'pass'     => 'bar',
 
-             'path'     => '/test',
 
-             'query'    => 'x=2',
 
-             'fragment' => 'xxx',
 
-         ];
 
-         self::assertSame('http://foo:bar@localhost:8080/test?x=2#xxx', Uri::buildUrl($parsed_url));
 
-         /** @var Uri $uri */
 
-         $uri = Grav::instance()['uri'];
 
-         $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html', '/subdir')->init();
 
-         self::assertSame('https://testing.dev/subdir/path1/path2/file.html', Uri::buildUrl($uri->toArray(true)));
 
-         $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.foo', '/subdir')->init();
 
-         self::assertSame('https://testing.dev/subdir/path1/path2/file.foo', Uri::buildUrl($uri->toArray(true)));
 
-         $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html', '/subdir/path1')->init();
 
-         self::assertSame('https://testing.dev/subdir/path1/path2/file.html', Uri::buildUrl($uri->toArray(true)));
 
-         $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom', '/subdir')->init();
 
-         self::assertSame('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom', Uri::buildUrl($uri->toArray(true)));
 
-         $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom?fig=something', '/subdir')->init();
 
-         self::assertSame('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom?fig=something', Uri::buildUrl($uri->toArray(true)));
 
-     }
 
-     public function testConvertUrl(): void
 
-     {
 
-     }
 
-     public function testAddNonce(): void
 
-     {
 
-         $this->runTestSet($this->tests, 'addNonce');
 
-     }
 
- }
 
 
  |