-
-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathUrl.parseQuery.phpt
More file actions
25 lines (20 loc) · 1017 Bytes
/
Url.parseQuery.phpt
File metadata and controls
25 lines (20 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php declare(strict_types=1);
/**
* Test: Nette\Http\Url::parseQuery()
* @phpIni arg_separator.input=&
*/
use Nette\Http\Url;
use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
Assert::same([], Url::parseQuery(''));
Assert::same(['key' => ''], Url::parseQuery('key'));
Assert::same(['key' => ''], Url::parseQuery('key='));
Assert::same(['key' => 'val'], Url::parseQuery('key=val'));
Assert::same(['key' => 'val;val'], Url::parseQuery('key=val;val'));
Assert::same(['key' => ''], Url::parseQuery('&key=&'));
Assert::same(['a' => ['val', 'val']], Url::parseQuery('a[]=val&a[]=val'));
Assert::same(['a' => ['x' => 'val', 'y' => 'val']], Url::parseQuery('%61[x]=val&%61[y]=val'));
Assert::same(['a b' => 'val', 'c' => ['d e' => 'val']], Url::parseQuery('a b=val&c[d e]=val'));
Assert::same(['a.b' => 'val', 'c' => ['d.e' => 'val']], Url::parseQuery('a.b=val&c[d.e]=val'));
Assert::same(['key"\'' => '"\''], Url::parseQuery('key"\'="\'')); // magic quotes
Assert::same([], Url::parseQuery('%00')); // null