diff options
author | Arthur <arthur@hoa.ro> | 2016-05-03 19:53:57 +0200 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2016-05-03 19:53:57 +0200 |
commit | 47be06098396b5eef35234b88227d64ab81bd988 (patch) | |
tree | bb42c742179e75c7f15c4126ddf79838ceb94331 /tests | |
parent | 5a63c34f3a68ce2f53ee9164e2a35a0904676399 (diff) | |
parent | ce7b0b6480aa854ee6893f5c889277b0e3b13efc (diff) | |
download | Shaarli-47be06098396b5eef35234b88227d64ab81bd988.tar.gz Shaarli-47be06098396b5eef35234b88227d64ab81bd988.tar.zst Shaarli-47be06098396b5eef35234b88227d64ab81bd988.zip |
Merge pull request #532 from ArthurHoaro/hotfix/title-retrieve-the-return
Fixes #531 - Title retrieving is failing with multiple use case
Diffstat (limited to 'tests')
-rw-r--r-- | tests/HttpUtils/GetHttpUrlTest.php | 27 | ||||
-rw-r--r-- | tests/Url/UrlTest.php | 15 |
2 files changed, 42 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 | } |
diff --git a/tests/Url/UrlTest.php b/tests/Url/UrlTest.php index a64a73ea..5fdc8617 100644 --- a/tests/Url/UrlTest.php +++ b/tests/Url/UrlTest.php | |||
@@ -181,4 +181,19 @@ class UrlTest extends PHPUnit_Framework_TestCase | |||
181 | $url = new Url('ftp://save.tld/mysave'); | 181 | $url = new Url('ftp://save.tld/mysave'); |
182 | $this->assertFalse($url->isHttp()); | 182 | $this->assertFalse($url->isHttp()); |
183 | } | 183 | } |
184 | |||
185 | /** | ||
186 | * Test IndToAscii. | ||
187 | */ | ||
188 | function testIndToAscii() | ||
189 | { | ||
190 | $ind = 'http://www.académie-française.fr/'; | ||
191 | $expected = 'http://www.xn--acadmie-franaise-npb1a.fr/'; | ||
192 | $url = new Url($ind); | ||
193 | $this->assertEquals($expected, $url->indToAscii()); | ||
194 | |||
195 | $notInd = 'http://www.academie-francaise.fr/'; | ||
196 | $url = new Url($notInd); | ||
197 | $this->assertEquals($notInd, $url->indToAscii()); | ||
198 | } | ||
184 | } | 199 | } |