$cleanUrl = $urlObj->idnToAscii();
if (!filter_var($cleanUrl, FILTER_VALIDATE_URL) || !$urlObj->isHttp()) {
- return array(array(0 => 'Invalid HTTP Url'), false);
+ return array(array(0 => 'Invalid HTTP UrlUtils'), false);
}
$userAgent =
}
/**
- * Test if the Url is an HTTP one.
+ * Test if the UrlUtils is an HTTP one.
*
* @return true is HTTP, false otherwise.
*/
/**
* Removes undesired query parameters and fragments
*
- * @param string url Url to be cleaned
+ * @param string url UrlUtils to be cleaned
*
* @return string the string representation of this URL after cleanup
*/
/**
* Get URL scheme.
*
- * @param string url Url for which the scheme is requested
+ * @param string url UrlUtils for which the scheme is requested
*
* @return mixed the URL scheme or false if none is provided.
*/
require_once 'application/ApplicationUtils.php';
require_once 'application/config/ConfigPlugin.php';
require_once 'application/feed/Cache.php';
+require_once 'application/http/HttpUtils.php';
+require_once 'application/http/UrlUtils.php';
require_once 'application/FileUtils.php';
require_once 'application/History.php';
-require_once 'application/HttpUtils.php';
require_once 'application/LinkDB.php';
require_once 'application/LinkFilter.php';
require_once 'application/LinkUtils.php';
require_once 'application/NetscapeBookmarkUtils.php';
require_once 'application/PageBuilder.php';
require_once 'application/TimeZone.php';
-require_once 'application/Url.php';
require_once 'application/Utils.php';
require_once 'application/PluginManager.php';
require_once 'application/Router.php';
* HttpUtils' tests
*/
-require_once 'application/HttpUtils.php';
+namespace Shaarli\Http;
+
+require_once 'application/http/HttpUtils.php';
/**
* Unitary tests for client_ip_id()
*/
-class ClientIpIdTest extends PHPUnit_Framework_TestCase
+class ClientIpIdTest extends \PHPUnit\Framework\TestCase
{
/**
* Get a remote client ID based on its IP
* HttpUtils' tests
*/
-require_once 'application/HttpUtils.php';
+namespace Shaarli\Http;
+
+require_once 'application/http/HttpUtils.php';
/**
* Unitary tests for get_http_response()
*/
-class GetHttpUrlTest extends PHPUnit_Framework_TestCase
+class GetHttpUrlTest extends \PHPUnit\Framework\TestCase
{
/**
* Get an invalid local URL
{
// Local
list($headers, $content) = get_http_response('/non/existent', 1);
- $this->assertEquals('Invalid HTTP Url', $headers[0]);
+ $this->assertEquals('Invalid HTTP UrlUtils', $headers[0]);
$this->assertFalse($content);
// Non HTTP
list($headers, $content) = get_http_response('ftp://save.tld/mysave', 1);
- $this->assertEquals('Invalid HTTP Url', $headers[0]);
+ $this->assertEquals('Invalid HTTP UrlUtils', $headers[0]);
$this->assertFalse($content);
}
<?php
-require_once 'application/HttpUtils.php';
+namespace Shaarli\Http;
+
+require_once 'application/http/HttpUtils.php';
/**
* Unitary tests for getIpAddressFromProxy()
*/
-class GetIpAdressFromProxyTest extends PHPUnit_Framework_TestCase
+class GetIpAdressFromProxyTest extends \PHPUnit\Framework\TestCase
{
/**
* HttpUtils' tests
*/
-require_once 'application/HttpUtils.php';
+namespace Shaarli\Http;
+
+require_once 'application/http/HttpUtils.php';
/**
* Unitary tests for index_url()
*/
-class IndexUrlTest extends PHPUnit_Framework_TestCase
+class IndexUrlTest extends \PHPUnit\Framework\TestCase
{
/**
* If on the main page, remove "index.php" from the URL resource
<?php
+namespace Shaarli\Http;
+
+require_once 'application/http/HttpUtils.php';
/**
* Class IsHttpsTest
*
* Test class for is_https() function.
*/
-class IsHttpsTest extends PHPUnit_Framework_TestCase
+class IsHttpsTest extends \PHPUnit\Framework\TestCase
{
/**
* HttpUtils' tests
*/
-require_once 'application/HttpUtils.php';
+namespace Shaarli\Http;
+
+require_once 'application/http/HttpUtils.php';
/**
* Unitary tests for page_url()
*/
-class PageUrlTest extends PHPUnit_Framework_TestCase
+class PageUrlTest extends \PHPUnit\Framework\TestCase
{
/**
* If on the main page, remove "index.php" from the URL resource
* HttpUtils' tests
*/
-require_once 'application/HttpUtils.php';
+namespace Shaarli\Http;
+
+require_once 'application/http/HttpUtils.php';
/**
* Unitary tests for server_url()
*/
-class ServerUrlTest extends PHPUnit_Framework_TestCase
+class ServerUrlTest extends \PHPUnit\Framework\TestCase
{
/**
* Detect if the server uses SSL
<?php
/**
- * Url's tests
+ * UrlUtils's tests
*/
namespace Shaarli\Http;
* Unitary tests for cleanup_url()
*/
-require_once 'application/Url.php';
+namespace Shaarli\Http;
-class CleanupUrlTest extends PHPUnit_Framework_TestCase
+require_once 'application/http/UrlUtils.php';
+
+class CleanupUrlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string reference URL
* Unitary tests for get_url_scheme()
*/
-require_once 'application/Url.php';
+namespace Shaarli\Http;
-class GetUrlSchemeTest extends PHPUnit_Framework_TestCase
+require_once 'application/http/UrlUtils.php';
+
+class GetUrlSchemeTest extends \PHPUnit\Framework\TestCase
{
/**
- * Get empty scheme string for empty Url
+ * Get empty scheme string for empty UrlUtils
*/
public function testGetUrlSchemeEmpty()
{
}
/**
- * Get normal scheme of Url
+ * Get normal scheme of UrlUtils
*/
public function testGetUrlScheme()
{
<?php
/**
- * Unpares Url's tests
+ * Unpares UrlUtils's tests
*/
-require_once 'application/Url.php';
+namespace Shaarli\Http;
+
+require_once 'application/http/UrlUtils.php';
/**
* Unitary tests for unparse_url()
*/
-class UnparseUrlTest extends PHPUnit_Framework_TestCase
+class UnparseUrlTest extends \PHPUnit\Framework\TestCase
{
/**
* Thanks for building nothing
<?php
-require_once 'application/Url.php';
+namespace Shaarli\Http;
-use Shaarli\Config\ConfigManager;
+require_once 'application/http/UrlUtils.php';
/**
* Class WhitelistProtocolsTest
*
- * Test whitelist_protocols() function of Url.
+ * Test whitelist_protocols() function of UrlUtils.
*/
-class WhitelistProtocolsTest extends PHPUnit_Framework_TestCase
+class WhitelistProtocolsTest extends \PHPUnit\Framework\TestCase
{
/**
* Test whitelist_protocols() on a note (relative URL).