diff options
Diffstat (limited to 'tests/HttpUtils')
-rw-r--r-- | tests/HttpUtils/GetHttpUrlTest.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/HttpUtils/GetHttpUrlTest.php b/tests/HttpUtils/GetHttpUrlTest.php index 76092b80..fd293505 100644 --- a/tests/HttpUtils/GetHttpUrlTest.php +++ b/tests/HttpUtils/GetHttpUrlTest.php | |||
@@ -6,7 +6,7 @@ | |||
6 | require_once 'application/HttpUtils.php'; | 6 | require_once 'application/HttpUtils.php'; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Unitary tests for get_http_url() | 9 | * Unitary tests for get_http_response() |
10 | */ | 10 | */ |
11 | class GetHttpUrlTest extends PHPUnit_Framework_TestCase | 11 | class GetHttpUrlTest extends PHPUnit_Framework_TestCase |
12 | { | 12 | { |
@@ -15,12 +15,15 @@ class GetHttpUrlTest extends PHPUnit_Framework_TestCase | |||
15 | */ | 15 | */ |
16 | public function testGetInvalidLocalUrl() | 16 | public function testGetInvalidLocalUrl() |
17 | { | 17 | { |
18 | list($headers, $content) = get_http_url('/non/existent', 1); | 18 | // Local |
19 | $this->assertEquals('HTTP Error', $headers[0]); | 19 | list($headers, $content) = get_http_response('/non/existent', 1); |
20 | $this->assertRegexp( | 20 | $this->assertEquals('Invalid HTTP Url', $headers[0]); |
21 | '/failed to open stream: No such file or directory/', | 21 | $this->assertFalse($content); |
22 | $content | 22 | |
23 | ); | 23 | // Non HTTP |
24 | list($headers, $content) = get_http_response('ftp://save.tld/mysave', 1); | ||
25 | $this->assertEquals('Invalid HTTP Url', $headers[0]); | ||
26 | $this->assertFalse($content); | ||
24 | } | 27 | } |
25 | 28 | ||
26 | /** | 29 | /** |
@@ -28,11 +31,8 @@ class GetHttpUrlTest extends PHPUnit_Framework_TestCase | |||
28 | */ | 31 | */ |
29 | public function testGetInvalidRemoteUrl() | 32 | public function testGetInvalidRemoteUrl() |
30 | { | 33 | { |
31 | list($headers, $content) = get_http_url('http://non.existent', 1); | 34 | list($headers, $content) = @get_http_response('http://non.existent', 1); |
32 | $this->assertEquals('HTTP Error', $headers[0]); | 35 | $this->assertFalse($headers); |
33 | $this->assertRegexp( | 36 | $this->assertFalse($content); |
34 | '/Name or service not known/', | ||
35 | $content | ||
36 | ); | ||
37 | } | 37 | } |
38 | } | 38 | } |