diff options
-rw-r--r-- | application/http/HttpUtils.php (renamed from application/HttpUtils.php) | 2 | ||||
-rw-r--r-- | application/http/Url.php | 2 | ||||
-rw-r--r-- | application/http/UrlUtils.php (renamed from application/Url.php) | 4 | ||||
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | tests/http/HttpUtils/ClientIpIdTest.php (renamed from tests/HttpUtils/ClientIpIdTest.php) | 6 | ||||
-rw-r--r-- | tests/http/HttpUtils/GetHttpUrlTest.php (renamed from tests/HttpUtils/GetHttpUrlTest.php) | 10 | ||||
-rw-r--r-- | tests/http/HttpUtils/GetIpAdressFromProxyTest.php (renamed from tests/HttpUtils/GetIpAdressFromProxyTest.php) | 6 | ||||
-rw-r--r-- | tests/http/HttpUtils/IndexUrlTest.php (renamed from tests/HttpUtils/IndexUrlTest.php) | 6 | ||||
-rw-r--r-- | tests/http/HttpUtils/IsHttpsTest.php (renamed from tests/HttpUtils/IsHttpsTest.php) | 5 | ||||
-rw-r--r-- | tests/http/HttpUtils/PageUrlTest.php (renamed from tests/HttpUtils/PageUrlTest.php) | 6 | ||||
-rw-r--r-- | tests/http/HttpUtils/ServerUrlTest.php (renamed from tests/HttpUtils/ServerUrlTest.php) | 6 | ||||
-rw-r--r-- | tests/http/UrlTest.php | 2 | ||||
-rw-r--r-- | tests/http/UrlUtils/CleanupUrlTest.php (renamed from tests/Url/CleanupUrlTest.php) | 6 | ||||
-rw-r--r-- | tests/http/UrlUtils/GetUrlSchemeTest.php (renamed from tests/Url/GetUrlSchemeTest.php) | 10 | ||||
-rw-r--r-- | tests/http/UrlUtils/UnparseUrlTest.php (renamed from tests/Url/UnparseUrlTest.php) | 8 | ||||
-rw-r--r-- | tests/http/UrlUtils/WhitelistProtocolsTest.php (renamed from tests/Url/WhitelistProtocolsTest.php) | 8 |
16 files changed, 56 insertions, 35 deletions
diff --git a/application/HttpUtils.php b/application/http/HttpUtils.php index 51af5d0d..2ea9195d 100644 --- a/application/HttpUtils.php +++ b/application/http/HttpUtils.php | |||
@@ -41,7 +41,7 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304, $curlWriteF | |||
41 | $cleanUrl = $urlObj->idnToAscii(); | 41 | $cleanUrl = $urlObj->idnToAscii(); |
42 | 42 | ||
43 | if (!filter_var($cleanUrl, FILTER_VALIDATE_URL) || !$urlObj->isHttp()) { | 43 | if (!filter_var($cleanUrl, FILTER_VALIDATE_URL) || !$urlObj->isHttp()) { |
44 | return array(array(0 => 'Invalid HTTP Url'), false); | 44 | return array(array(0 => 'Invalid HTTP UrlUtils'), false); |
45 | } | 45 | } |
46 | 46 | ||
47 | $userAgent = | 47 | $userAgent = |
diff --git a/application/http/Url.php b/application/http/Url.php index 260231c6..90444a2f 100644 --- a/application/http/Url.php +++ b/application/http/Url.php | |||
@@ -206,7 +206,7 @@ class Url | |||
206 | } | 206 | } |
207 | 207 | ||
208 | /** | 208 | /** |
209 | * Test if the Url is an HTTP one. | 209 | * Test if the UrlUtils is an HTTP one. |
210 | * | 210 | * |
211 | * @return true is HTTP, false otherwise. | 211 | * @return true is HTTP, false otherwise. |
212 | */ | 212 | */ |
diff --git a/application/Url.php b/application/http/UrlUtils.php index 81f72fb0..4bc84b82 100644 --- a/application/Url.php +++ b/application/http/UrlUtils.php | |||
@@ -28,7 +28,7 @@ function unparse_url($parsedUrl) | |||
28 | /** | 28 | /** |
29 | * Removes undesired query parameters and fragments | 29 | * Removes undesired query parameters and fragments |
30 | * | 30 | * |
31 | * @param string url Url to be cleaned | 31 | * @param string url UrlUtils to be cleaned |
32 | * | 32 | * |
33 | * @return string the string representation of this URL after cleanup | 33 | * @return string the string representation of this URL after cleanup |
34 | */ | 34 | */ |
@@ -41,7 +41,7 @@ function cleanup_url($url) | |||
41 | /** | 41 | /** |
42 | * Get URL scheme. | 42 | * Get URL scheme. |
43 | * | 43 | * |
44 | * @param string url Url for which the scheme is requested | 44 | * @param string url UrlUtils for which the scheme is requested |
45 | * | 45 | * |
46 | * @return mixed the URL scheme or false if none is provided. | 46 | * @return mixed the URL scheme or false if none is provided. |
47 | */ | 47 | */ |
@@ -59,16 +59,16 @@ require_once __DIR__ . '/vendor/autoload.php'; | |||
59 | require_once 'application/ApplicationUtils.php'; | 59 | require_once 'application/ApplicationUtils.php'; |
60 | require_once 'application/config/ConfigPlugin.php'; | 60 | require_once 'application/config/ConfigPlugin.php'; |
61 | require_once 'application/feed/Cache.php'; | 61 | require_once 'application/feed/Cache.php'; |
62 | require_once 'application/http/HttpUtils.php'; | ||
63 | require_once 'application/http/UrlUtils.php'; | ||
62 | require_once 'application/FileUtils.php'; | 64 | require_once 'application/FileUtils.php'; |
63 | require_once 'application/History.php'; | 65 | require_once 'application/History.php'; |
64 | require_once 'application/HttpUtils.php'; | ||
65 | require_once 'application/LinkDB.php'; | 66 | require_once 'application/LinkDB.php'; |
66 | require_once 'application/LinkFilter.php'; | 67 | require_once 'application/LinkFilter.php'; |
67 | require_once 'application/LinkUtils.php'; | 68 | require_once 'application/LinkUtils.php'; |
68 | require_once 'application/NetscapeBookmarkUtils.php'; | 69 | require_once 'application/NetscapeBookmarkUtils.php'; |
69 | require_once 'application/PageBuilder.php'; | 70 | require_once 'application/PageBuilder.php'; |
70 | require_once 'application/TimeZone.php'; | 71 | require_once 'application/TimeZone.php'; |
71 | require_once 'application/Url.php'; | ||
72 | require_once 'application/Utils.php'; | 72 | require_once 'application/Utils.php'; |
73 | require_once 'application/PluginManager.php'; | 73 | require_once 'application/PluginManager.php'; |
74 | require_once 'application/Router.php'; | 74 | require_once 'application/Router.php'; |
diff --git a/tests/HttpUtils/ClientIpIdTest.php b/tests/http/HttpUtils/ClientIpIdTest.php index c15ac5cc..982e57e0 100644 --- a/tests/HttpUtils/ClientIpIdTest.php +++ b/tests/http/HttpUtils/ClientIpIdTest.php | |||
@@ -3,12 +3,14 @@ | |||
3 | * HttpUtils' tests | 3 | * HttpUtils' tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/HttpUtils.php'; | 6 | namespace Shaarli\Http; |
7 | |||
8 | require_once 'application/http/HttpUtils.php'; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Unitary tests for client_ip_id() | 11 | * Unitary tests for client_ip_id() |
10 | */ | 12 | */ |
11 | class ClientIpIdTest extends PHPUnit_Framework_TestCase | 13 | class ClientIpIdTest extends \PHPUnit\Framework\TestCase |
12 | { | 14 | { |
13 | /** | 15 | /** |
14 | * Get a remote client ID based on its IP | 16 | * Get a remote client ID based on its IP |
diff --git a/tests/HttpUtils/GetHttpUrlTest.php b/tests/http/HttpUtils/GetHttpUrlTest.php index ea53de5f..3dc5bc9b 100644 --- a/tests/HttpUtils/GetHttpUrlTest.php +++ b/tests/http/HttpUtils/GetHttpUrlTest.php | |||
@@ -3,12 +3,14 @@ | |||
3 | * HttpUtils' tests | 3 | * HttpUtils' tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/HttpUtils.php'; | 6 | namespace Shaarli\Http; |
7 | |||
8 | require_once 'application/http/HttpUtils.php'; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Unitary tests for get_http_response() | 11 | * Unitary tests for get_http_response() |
10 | */ | 12 | */ |
11 | class GetHttpUrlTest extends PHPUnit_Framework_TestCase | 13 | class GetHttpUrlTest extends \PHPUnit\Framework\TestCase |
12 | { | 14 | { |
13 | /** | 15 | /** |
14 | * Get an invalid local URL | 16 | * Get an invalid local URL |
@@ -17,12 +19,12 @@ class GetHttpUrlTest extends PHPUnit_Framework_TestCase | |||
17 | { | 19 | { |
18 | // Local | 20 | // Local |
19 | list($headers, $content) = get_http_response('/non/existent', 1); | 21 | list($headers, $content) = get_http_response('/non/existent', 1); |
20 | $this->assertEquals('Invalid HTTP Url', $headers[0]); | 22 | $this->assertEquals('Invalid HTTP UrlUtils', $headers[0]); |
21 | $this->assertFalse($content); | 23 | $this->assertFalse($content); |
22 | 24 | ||
23 | // Non HTTP | 25 | // Non HTTP |
24 | list($headers, $content) = get_http_response('ftp://save.tld/mysave', 1); | 26 | list($headers, $content) = get_http_response('ftp://save.tld/mysave', 1); |
25 | $this->assertEquals('Invalid HTTP Url', $headers[0]); | 27 | $this->assertEquals('Invalid HTTP UrlUtils', $headers[0]); |
26 | $this->assertFalse($content); | 28 | $this->assertFalse($content); |
27 | } | 29 | } |
28 | 30 | ||
diff --git a/tests/HttpUtils/GetIpAdressFromProxyTest.php b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php index 7af5bd9d..fe3a639e 100644 --- a/tests/HttpUtils/GetIpAdressFromProxyTest.php +++ b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php | |||
@@ -1,11 +1,13 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | require_once 'application/HttpUtils.php'; | 3 | namespace Shaarli\Http; |
4 | |||
5 | require_once 'application/http/HttpUtils.php'; | ||
4 | 6 | ||
5 | /** | 7 | /** |
6 | * Unitary tests for getIpAddressFromProxy() | 8 | * Unitary tests for getIpAddressFromProxy() |
7 | */ | 9 | */ |
8 | class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase | 10 | class GetIpAdressFromProxyTest extends \PHPUnit\Framework\TestCase |
9 | { | 11 | { |
10 | 12 | ||
11 | /** | 13 | /** |
diff --git a/tests/HttpUtils/IndexUrlTest.php b/tests/http/HttpUtils/IndexUrlTest.php index 337dcab0..bcbe59cb 100644 --- a/tests/HttpUtils/IndexUrlTest.php +++ b/tests/http/HttpUtils/IndexUrlTest.php | |||
@@ -3,12 +3,14 @@ | |||
3 | * HttpUtils' tests | 3 | * HttpUtils' tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/HttpUtils.php'; | 6 | namespace Shaarli\Http; |
7 | |||
8 | require_once 'application/http/HttpUtils.php'; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Unitary tests for index_url() | 11 | * Unitary tests for index_url() |
10 | */ | 12 | */ |
11 | class IndexUrlTest extends PHPUnit_Framework_TestCase | 13 | class IndexUrlTest extends \PHPUnit\Framework\TestCase |
12 | { | 14 | { |
13 | /** | 15 | /** |
14 | * If on the main page, remove "index.php" from the URL resource | 16 | * If on the main page, remove "index.php" from the URL resource |
diff --git a/tests/HttpUtils/IsHttpsTest.php b/tests/http/HttpUtils/IsHttpsTest.php index 097f2bcf..348956c6 100644 --- a/tests/HttpUtils/IsHttpsTest.php +++ b/tests/http/HttpUtils/IsHttpsTest.php | |||
@@ -1,12 +1,15 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Shaarli\Http; | ||
4 | |||
5 | require_once 'application/http/HttpUtils.php'; | ||
3 | 6 | ||
4 | /** | 7 | /** |
5 | * Class IsHttpsTest | 8 | * Class IsHttpsTest |
6 | * | 9 | * |
7 | * Test class for is_https() function. | 10 | * Test class for is_https() function. |
8 | */ | 11 | */ |
9 | class IsHttpsTest extends PHPUnit_Framework_TestCase | 12 | class IsHttpsTest extends \PHPUnit\Framework\TestCase |
10 | { | 13 | { |
11 | 14 | ||
12 | /** | 15 | /** |
diff --git a/tests/HttpUtils/PageUrlTest.php b/tests/http/HttpUtils/PageUrlTest.php index 4dbbe9cf..f1991716 100644 --- a/tests/HttpUtils/PageUrlTest.php +++ b/tests/http/HttpUtils/PageUrlTest.php | |||
@@ -3,12 +3,14 @@ | |||
3 | * HttpUtils' tests | 3 | * HttpUtils' tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/HttpUtils.php'; | 6 | namespace Shaarli\Http; |
7 | |||
8 | require_once 'application/http/HttpUtils.php'; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Unitary tests for page_url() | 11 | * Unitary tests for page_url() |
10 | */ | 12 | */ |
11 | class PageUrlTest extends PHPUnit_Framework_TestCase | 13 | class PageUrlTest extends \PHPUnit\Framework\TestCase |
12 | { | 14 | { |
13 | /** | 15 | /** |
14 | * If on the main page, remove "index.php" from the URL resource | 16 | * If on the main page, remove "index.php" from the URL resource |
diff --git a/tests/HttpUtils/ServerUrlTest.php b/tests/http/HttpUtils/ServerUrlTest.php index 324b827a..9caf1049 100644 --- a/tests/HttpUtils/ServerUrlTest.php +++ b/tests/http/HttpUtils/ServerUrlTest.php | |||
@@ -3,12 +3,14 @@ | |||
3 | * HttpUtils' tests | 3 | * HttpUtils' tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/HttpUtils.php'; | 6 | namespace Shaarli\Http; |
7 | |||
8 | require_once 'application/http/HttpUtils.php'; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Unitary tests for server_url() | 11 | * Unitary tests for server_url() |
10 | */ | 12 | */ |
11 | class ServerUrlTest extends PHPUnit_Framework_TestCase | 13 | class ServerUrlTest extends \PHPUnit\Framework\TestCase |
12 | { | 14 | { |
13 | /** | 15 | /** |
14 | * Detect if the server uses SSL | 16 | * Detect if the server uses SSL |
diff --git a/tests/http/UrlTest.php b/tests/http/UrlTest.php index 011b416d..342b78a4 100644 --- a/tests/http/UrlTest.php +++ b/tests/http/UrlTest.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | /** | 2 | /** |
3 | * Url's tests | 3 | * UrlUtils's tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | namespace Shaarli\Http; | 6 | namespace Shaarli\Http; |
diff --git a/tests/Url/CleanupUrlTest.php b/tests/http/UrlUtils/CleanupUrlTest.php index 24791948..6c4d124b 100644 --- a/tests/Url/CleanupUrlTest.php +++ b/tests/http/UrlUtils/CleanupUrlTest.php | |||
@@ -3,9 +3,11 @@ | |||
3 | * Unitary tests for cleanup_url() | 3 | * Unitary tests for cleanup_url() |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/Url.php'; | 6 | namespace Shaarli\Http; |
7 | 7 | ||
8 | class CleanupUrlTest extends PHPUnit_Framework_TestCase | 8 | require_once 'application/http/UrlUtils.php'; |
9 | |||
10 | class CleanupUrlTest extends \PHPUnit\Framework\TestCase | ||
9 | { | 11 | { |
10 | /** | 12 | /** |
11 | * @var string reference URL | 13 | * @var string reference URL |
diff --git a/tests/Url/GetUrlSchemeTest.php b/tests/http/UrlUtils/GetUrlSchemeTest.php index 18b932d6..2b97f7be 100644 --- a/tests/Url/GetUrlSchemeTest.php +++ b/tests/http/UrlUtils/GetUrlSchemeTest.php | |||
@@ -3,12 +3,14 @@ | |||
3 | * Unitary tests for get_url_scheme() | 3 | * Unitary tests for get_url_scheme() |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/Url.php'; | 6 | namespace Shaarli\Http; |
7 | 7 | ||
8 | class GetUrlSchemeTest extends PHPUnit_Framework_TestCase | 8 | require_once 'application/http/UrlUtils.php'; |
9 | |||
10 | class GetUrlSchemeTest extends \PHPUnit\Framework\TestCase | ||
9 | { | 11 | { |
10 | /** | 12 | /** |
11 | * Get empty scheme string for empty Url | 13 | * Get empty scheme string for empty UrlUtils |
12 | */ | 14 | */ |
13 | public function testGetUrlSchemeEmpty() | 15 | public function testGetUrlSchemeEmpty() |
14 | { | 16 | { |
@@ -16,7 +18,7 @@ class GetUrlSchemeTest extends PHPUnit_Framework_TestCase | |||
16 | } | 18 | } |
17 | 19 | ||
18 | /** | 20 | /** |
19 | * Get normal scheme of Url | 21 | * Get normal scheme of UrlUtils |
20 | */ | 22 | */ |
21 | public function testGetUrlScheme() | 23 | public function testGetUrlScheme() |
22 | { | 24 | { |
diff --git a/tests/Url/UnparseUrlTest.php b/tests/http/UrlUtils/UnparseUrlTest.php index e314b484..040d8c54 100644 --- a/tests/Url/UnparseUrlTest.php +++ b/tests/http/UrlUtils/UnparseUrlTest.php | |||
@@ -1,14 +1,16 @@ | |||
1 | <?php | 1 | <?php |
2 | /** | 2 | /** |
3 | * Unpares Url's tests | 3 | * Unpares UrlUtils's tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/Url.php'; | 6 | namespace Shaarli\Http; |
7 | |||
8 | require_once 'application/http/UrlUtils.php'; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * Unitary tests for unparse_url() | 11 | * Unitary tests for unparse_url() |
10 | */ | 12 | */ |
11 | class UnparseUrlTest extends PHPUnit_Framework_TestCase | 13 | class UnparseUrlTest extends \PHPUnit\Framework\TestCase |
12 | { | 14 | { |
13 | /** | 15 | /** |
14 | * Thanks for building nothing | 16 | * Thanks for building nothing |
diff --git a/tests/Url/WhitelistProtocolsTest.php b/tests/http/UrlUtils/WhitelistProtocolsTest.php index a3156804..69512dbd 100644 --- a/tests/Url/WhitelistProtocolsTest.php +++ b/tests/http/UrlUtils/WhitelistProtocolsTest.php | |||
@@ -1,15 +1,15 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | require_once 'application/Url.php'; | 3 | namespace Shaarli\Http; |
4 | 4 | ||
5 | use Shaarli\Config\ConfigManager; | 5 | require_once 'application/http/UrlUtils.php'; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Class WhitelistProtocolsTest | 8 | * Class WhitelistProtocolsTest |
9 | * | 9 | * |
10 | * Test whitelist_protocols() function of Url. | 10 | * Test whitelist_protocols() function of UrlUtils. |
11 | */ | 11 | */ |
12 | class WhitelistProtocolsTest extends PHPUnit_Framework_TestCase | 12 | class WhitelistProtocolsTest extends \PHPUnit\Framework\TestCase |
13 | { | 13 | { |
14 | /** | 14 | /** |
15 | * Test whitelist_protocols() on a note (relative URL). | 15 | * Test whitelist_protocols() on a note (relative URL). |