summaryrefslogtreecommitdiff
path: root/test/it_url.t
diff options
context:
space:
mode:
authorUrban Müller2020-04-21 01:03:53 +0200
committerUrban Müller2020-04-21 01:03:53 +0200
commitd987adefc85095f057c3d6d3eb2fa4c0d487d32b (patch)
tree4a6f7be8e35ff0c412666c41a46f22383d8ed5c2 /test/it_url.t
parent1bd13e02d21ba01f38cd6df04de84b25a75a5264 (diff)
downloaditools-d987adefc85095f057c3d6d3eb2fa4c0d487d32b.tar.gz
itools-d987adefc85095f057c3d6d3eb2fa4c0d487d32b.tar.bz2
itools-d987adefc85095f057c3d6d3eb2fa4c0d487d32b.zip
use new array syntax
Diffstat (limited to 'test/it_url.t')
-rwxr-xr-xtest/it_url.t26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/it_url.t b/test/it_url.t
index b265afa..edfbdb2 100755
--- a/test/it_url.t
+++ b/test/it_url.t
@@ -137,7 +137,7 @@ ok(
);
$url = new it_url('http://bogus.url');
-$page = $url->get(array('url' => 'http://www.gna.ch/'));
+$page = $url->get(['url' => 'http://www.gna.ch/']);
ok(
strpos($page, '</html>'), # UTF8SAFE
'$url->get(\'url\' => url) with url as named arg'
@@ -236,7 +236,7 @@ handle_server(
$output = handle_server(
ok(
- !it_url::get(array('url' => U('http://localhost:8000/redirect_loop', array('num' => 40)), 'it_error' => false)),
+ !it_url::get(['url' => U('http://localhost:8000/redirect_loop', ['num' => 40]), 'it_error' => false]),
'it_url::get() handles redirect loop'
)
);
@@ -249,7 +249,7 @@ if (!ok(
$output = handle_server(
ok(
- !it_url::get(array('url' => 'http://localhost:8000/does_not_exist', 'retries' => 4)),
+ !it_url::get(['url' => 'http://localhost:8000/does_not_exist', 'retries' => 4]),
'it_url::get() on 404'
)
);
@@ -261,7 +261,7 @@ if (!ok(
$output = handle_server(
ok(
- !it_url::get(array('url' => 'http://localhost:8000/repeat?num=0', 'retries' => 4)),
+ !it_url::get(['url' => 'http://localhost:8000/repeat?num=0', 'retries' => 4]),
'it_url::get() on empty page'
)
);
@@ -286,7 +286,7 @@ if (!ok(
handle_server(
is(
- it_url::get(U('http://localhost:8000/get_server_value', array('key' => 'HTTP_HOST'))),
+ it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_HOST'])),
'localhost:8000',
'it_url::get() sets correct Host header'
)
@@ -294,7 +294,7 @@ handle_server(
handle_server(
is(
- it_url::get(U('http://localhost:8000/get_server_value', array('key' => 'HTTP_ACCEPT_LANGUAGE'))),
+ it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_ACCEPT_LANGUAGE'])),
T_lang(),
'it_url::get() sets correct Accept-Language header'
)
@@ -302,14 +302,14 @@ handle_server(
handle_server(
ok(
- it::match('Mozilla', it_url::get(U('http://localhost:8000/get_server_value', array('key' => 'HTTP_USER_AGENT')))),
+ it::match('Mozilla', it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_USER_AGENT']))),
'it_url::get() sets User-Agent containing Mozilla'
)
);
handle_server(
is(
- it_url::get(U('http://user:password@localhost:8000/get_server_value', array('key' => 'PHP_AUTH_USER'))),
+ it_url::get(U('http://user:password@localhost:8000/get_server_value', ['key' => 'PHP_AUTH_USER'])),
'user',
'it_url::get() basic authentication user'
)
@@ -317,17 +317,17 @@ handle_server(
handle_server(
is(
- it_url::get(U('http://user:password@localhost:8000/get_server_value', array('key' => 'PHP_AUTH_PW'))),
+ it_url::get(U('http://user:password@localhost:8000/get_server_value', ['key' => 'PHP_AUTH_PW'])),
'password',
'it_url::get() basic authentication password'
)
);
-$pages = it_url::get_multi(array('urls' => array('a' => 'http://www.gna.ch/', 'b' => 'http://search.ch/')));
+$pages = it_url::get_multi(['urls' => ['a' => 'http://www.gna.ch/', 'b' => 'http://search.ch/']]);
ok(strpos($pages['a'], '</html>'), 'it_url::get_multi got first url'); # UTF8SAFE
ok(strpos($pages['b'], '</html>'), 'it_url::get_multi got second url'); # UTF8SAFE
is(count($pages), 2, 'it_url::get_multi no additional array elements');
-is(it_url::parse("/foo"), array("/foo"), "it_url::parse path only");
-is(it_url::parse("/foo?"), array("/foo"), "it_url::parse empty parameter");
-is(it_url::parse("/foo?bar=baz&qux=quux"), array("/foo", 'bar' => "baz", 'qux' => "quux"), "it_url::parse parameters");
+is(it_url::parse("/foo"), ["/foo"], "it_url::parse path only");
+is(it_url::parse("/foo?"), ["/foo"], "it_url::parse empty parameter");
+is(it_url::parse("/foo?bar=baz&qux=quux"), ["/foo", 'bar' => "baz", 'qux' => "quux"], "it_url::parse parameters");