aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/HttpUtils
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-04-06 22:00:52 +0200
committerArthurHoaro <arthur@hoa.ro>2016-05-03 19:51:29 +0200
commitce7b0b6480aa854ee6893f5c889277b0e3b13efc (patch)
tree8d8beb4ea5568d9989a5ebf52e2adc542e17f74e /tests/HttpUtils
parent11609d9fd8ba53f049e6c913d8e3affab6cfc9ce (diff)
downloadShaarli-ce7b0b6480aa854ee6893f5c889277b0e3b13efc.tar.gz
Shaarli-ce7b0b6480aa854ee6893f5c889277b0e3b13efc.tar.zst
Shaarli-ce7b0b6480aa854ee6893f5c889277b0e3b13efc.zip
Fixes #531 - Title retrieving is failing with multiple use case
see https://github.com/shaarli/Shaarli/issues/531 for details
Diffstat (limited to 'tests/HttpUtils')
-rw-r--r--tests/HttpUtils/GetHttpUrlTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/HttpUtils/GetHttpUrlTest.php b/tests/HttpUtils/GetHttpUrlTest.php
index fd293505..ea53de5f 100644
--- a/tests/HttpUtils/GetHttpUrlTest.php
+++ b/tests/HttpUtils/GetHttpUrlTest.php
@@ -35,4 +35,31 @@ class GetHttpUrlTest extends PHPUnit_Framework_TestCase
35 $this->assertFalse($headers); 35 $this->assertFalse($headers);
36 $this->assertFalse($content); 36 $this->assertFalse($content);
37 } 37 }
38
39 /**
40 * Test getAbsoluteUrl with relative target URL.
41 */
42 public function testGetAbsoluteUrlWithRelative()
43 {
44 $origin = 'http://non.existent/blabla/?test';
45 $target = '/stuff.php';
46
47 $expected = 'http://non.existent/stuff.php';
48 $this->assertEquals($expected, getAbsoluteUrl($origin, $target));
49
50 $target = 'stuff.php';
51 $expected = 'http://non.existent/blabla/stuff.php';
52 $this->assertEquals($expected, getAbsoluteUrl($origin, $target));
53 }
54
55 /**
56 * Test getAbsoluteUrl with absolute target URL.
57 */
58 public function testGetAbsoluteUrlWithAbsolute()
59 {
60 $origin = 'http://non.existent/blabla/?test';
61 $target = 'http://other.url/stuff.php';
62
63 $this->assertEquals($target, getAbsoluteUrl($origin, $target));
64 }
38} 65}