aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/HttpUtils/GetHttpUrlTest.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-09-14 20:40:41 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-09-14 20:40:41 +0200
commit4df3520d6e6768324b3120a3a2b317fb4ef0461b (patch)
treeb4e7c6ddaa1d88cc49bc96c2524f12431d8fcce0 /tests/HttpUtils/GetHttpUrlTest.php
parentce47a75864d7d398a68705df67da2ae00ca89eca (diff)
parent482d67bd523bf12f36508a0131d09fe299ee02f4 (diff)
downloadShaarli-4df3520d6e6768324b3120a3a2b317fb4ef0461b.tar.gz
Shaarli-4df3520d6e6768324b3120a3a2b317fb4ef0461b.tar.zst
Shaarli-4df3520d6e6768324b3120a3a2b317fb4ef0461b.zip
Merge pull request #346 from virtualtam/refactor/http-url-utils
HTTP: move server URL functions to `HttpUtils.php`
Diffstat (limited to 'tests/HttpUtils/GetHttpUrlTest.php')
-rw-r--r--tests/HttpUtils/GetHttpUrlTest.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/HttpUtils/GetHttpUrlTest.php b/tests/HttpUtils/GetHttpUrlTest.php
new file mode 100644
index 00000000..76092b80
--- /dev/null
+++ b/tests/HttpUtils/GetHttpUrlTest.php
@@ -0,0 +1,38 @@
1<?php
2/**
3 * HttpUtils' tests
4 */
5
6require_once 'application/HttpUtils.php';
7
8/**
9 * Unitary tests for get_http_url()
10 */
11class GetHttpUrlTest extends PHPUnit_Framework_TestCase
12{
13 /**
14 * Get an invalid local URL
15 */
16 public function testGetInvalidLocalUrl()
17 {
18 list($headers, $content) = get_http_url('/non/existent', 1);
19 $this->assertEquals('HTTP Error', $headers[0]);
20 $this->assertRegexp(
21 '/failed to open stream: No such file or directory/',
22 $content
23 );
24 }
25
26 /**
27 * Get an invalid remote URL
28 */
29 public function testGetInvalidRemoteUrl()
30 {
31 list($headers, $content) = get_http_url('http://non.existent', 1);
32 $this->assertEquals('HTTP Error', $headers[0]);
33 $this->assertRegexp(
34 '/Name or service not known/',
35 $content
36 );
37 }
38}