From ef591e7ee21435da9314c5f7f6ea983c6f423898 Mon Sep 17 00:00:00 2001 From: Guillaume Virlet Date: Wed, 2 Sep 2015 13:55:39 +0200 Subject: Url: introduce global helper functions for cleanup and scheme detection Relates to #314 & #326 Additions: - add global `cleanup_url()` and `get_url_scheme()` functions Modifications: - replace `Url` usage in `index.php` by calls to global functions - fix `Url` tests not being run: PHPUnit expects a single test class per file - move classes to separate files --- tests/Url/GetUrlSchemeTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/Url/GetUrlSchemeTest.php (limited to 'tests/Url/GetUrlSchemeTest.php') diff --git a/tests/Url/GetUrlSchemeTest.php b/tests/Url/GetUrlSchemeTest.php new file mode 100644 index 00000000..72d80b30 --- /dev/null +++ b/tests/Url/GetUrlSchemeTest.php @@ -0,0 +1,31 @@ +assertEquals('', get_url_scheme('')); + } + + /** + * Get normal scheme of Url + */ + public function testGetUrlScheme() + { + $this->assertEquals('http', get_url_scheme('http://domain.tld:3000')); + $this->assertEquals('https', get_url_scheme('https://domain.tld:3000')); + $this->assertEquals('http', get_url_scheme('domain.tld')); + $this->assertEquals('ssh', get_url_scheme('ssh://domain.tld')); + $this->assertEquals('ftp', get_url_scheme('ftp://domain.tld')); + $this->assertEquals('git', get_url_scheme('git://domain.tld/push?pull=clone#checkout')); + } +} + -- cgit v1.2.3