From 2393e0b28699675b5c6755a615e439af6ac31b37 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 18 May 2020 09:54:20 +0200 Subject: Add 'assoc' => true mode to it_url::get() and prepare to mark function static --- test/it_url.t | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/it_url.t b/test/it_url.t index edfbdb2..5bac758 100755 --- a/test/it_url.t +++ b/test/it_url.t @@ -119,41 +119,29 @@ is( $url = new it_url('http://www.gna.ch/'); is((bool)$url->is_reachable(), true, "is_reachable($url->url)"); -$page = $url->get(); -ok( - strpos($page, ''), # UTF8SAFE - '$url->get with url in constructor' -); $url = new it_url('http://www.search.ch/not_found'); is((bool)$url->is_reachable(), false, "is_reachable($url->url)"); $url = new it_url('http://bogus.url'); is((bool)$url->is_reachable(), false, "is_reachable($url->url)"); -$page = $url->get('http://www.gna.ch/'); -ok( - strpos($page, ''), # UTF8SAFE - '$url->get(url) with url as string arg' -); -$url = new it_url('http://bogus.url'); -$page = $url->get(['url' => 'http://www.gna.ch/']); +$response = it_url::get(['url' => 'http://www.gna.ch/', 'assoc' => true]); ok( - strpos($page, ''), # UTF8SAFE - '$url->get(\'url\' => url) with url as named arg' + strpos($response['data'], ''), # UTF8SAFE + 'Get with url as named arg' ); is( - $url->result, + $response['status'], '200', - '$url->result = 200' + 'Reponse status = 200' ); is( - $url->headers['Server'], + $response['headers']['Server'], 'Apache', - '$url->headers correctly set' + 'Response headers correctly set' ); -unset($url, $page); $page = it_url::get('http://www.gna.ch/'); ok( strpos($page, ''), # UTF8SAFE -- cgit v1.2.3