aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/HttpUtils/GetHttpUrlTest.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2016-01-11 21:47:00 +0100
committerVirtualTam <virtualtam@flibidi.net>2016-01-11 21:47:00 +0100
commit92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44 (patch)
tree787f6d8fdabe8ea2fc0c37b61d616e667cdfbda5 /tests/HttpUtils/GetHttpUrlTest.php
parentc0a50f3663e207d5df007e0fa321219c1b32d6ea (diff)
parent1557cefbd76257ceb830f65806831b490faf0acc (diff)
downloadShaarli-92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44.tar.gz
Shaarli-92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44.tar.zst
Shaarli-92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44.zip
Merge pull request #432 from ArthurHoaro/title-retrieve
Fixes #410 - Retrieve title fails in multiple cases
Diffstat (limited to 'tests/HttpUtils/GetHttpUrlTest.php')
-rw-r--r--tests/HttpUtils/GetHttpUrlTest.php26
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 @@
6require_once 'application/HttpUtils.php'; 6require_once 'application/HttpUtils.php';
7 7
8/** 8/**
9 * Unitary tests for get_http_url() 9 * Unitary tests for get_http_response()
10 */ 10 */
11class GetHttpUrlTest extends PHPUnit_Framework_TestCase 11class 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}