From 51753e403fa69c0ce124ede27d300477e3e799ca Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Mon, 3 Dec 2018 00:34:53 +0100 Subject: namespacing: move HTTP utilities along \Shaarli\Http\ classes Signed-off-by: VirtualTam --- tests/Url/WhitelistProtocolsTest.php | 63 ------------------------------------ 1 file changed, 63 deletions(-) delete mode 100644 tests/Url/WhitelistProtocolsTest.php (limited to 'tests/Url/WhitelistProtocolsTest.php') diff --git a/tests/Url/WhitelistProtocolsTest.php b/tests/Url/WhitelistProtocolsTest.php deleted file mode 100644 index a3156804..00000000 --- a/tests/Url/WhitelistProtocolsTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assertEquals($url, whitelist_protocols($url, $whitelist)); - $url = '/path.jpg'; - $this->assertEquals($url, whitelist_protocols($url, $whitelist)); - } - - /** - * Test whitelist_protocols() on a note (relative URL). - */ - public function testWhitelistProtocolMissing() - { - $whitelist = ['ftp', 'magnet']; - $url = 'test.tld/path/?query=value#hash'; - $this->assertEquals('http://'. $url, whitelist_protocols($url, $whitelist)); - } - - /** - * Test whitelist_protocols() with allowed protocols. - */ - public function testWhitelistAllowedProtocol() - { - $whitelist = ['ftp', 'magnet']; - $url = 'http://test.tld/path/?query=value#hash'; - $this->assertEquals($url, whitelist_protocols($url, $whitelist)); - $url = 'https://test.tld/path/?query=value#hash'; - $this->assertEquals($url, whitelist_protocols($url, $whitelist)); - $url = 'ftp://test.tld/path/?query=value#hash'; - $this->assertEquals($url, whitelist_protocols($url, $whitelist)); - $url = 'magnet:test.tld/path/?query=value#hash'; - $this->assertEquals($url, whitelist_protocols($url, $whitelist)); - } - - /** - * Test whitelist_protocols() with allowed protocols. - */ - public function testWhitelistDisallowedProtocol() - { - $whitelist = ['ftp', 'magnet']; - $url = 'javascript:alert("xss");'; - $this->assertEquals('http://alert("xss");', whitelist_protocols($url, $whitelist)); - $url = 'other://test.tld/path/?query=value#hash'; - $this->assertEquals('http://test.tld/path/?query=value#hash', whitelist_protocols($url, $whitelist)); - } -} -- cgit v1.2.3