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/HttpUtils/GetIpAdressFromProxyTest.php | 59 ---------------------------- 1 file changed, 59 deletions(-) delete mode 100644 tests/HttpUtils/GetIpAdressFromProxyTest.php (limited to 'tests/HttpUtils/GetIpAdressFromProxyTest.php') diff --git a/tests/HttpUtils/GetIpAdressFromProxyTest.php b/tests/HttpUtils/GetIpAdressFromProxyTest.php deleted file mode 100644 index 7af5bd9d..00000000 --- a/tests/HttpUtils/GetIpAdressFromProxyTest.php +++ /dev/null @@ -1,59 +0,0 @@ -assertFalse(getIpAddressFromProxy(array(), array())); - } - - /** - * Test with a single IP in proxy header. - */ - public function testWithOneForwardedIp() - { - $ip = '1.1.1.1'; - $server = array('HTTP_X_FORWARDED_FOR' => $ip); - $this->assertEquals($ip, getIpAddressFromProxy($server, array())); - } - - /** - * Test with a multiple IPs in proxy header. - */ - public function testWithMultipleForwardedIp() - { - $ip = '1.1.1.1'; - $ip2 = '2.2.2.2'; - - $server = array('HTTP_X_FORWARDED_FOR' => $ip .','. $ip2); - $this->assertEquals($ip2, getIpAddressFromProxy($server, array())); - - $server = array('HTTP_X_FORWARDED_FOR' => $ip .' , '. $ip2); - $this->assertEquals($ip2, getIpAddressFromProxy($server, array())); - } - - /** - * Test with a trusted IP address. - */ - public function testWithTrustedIp() - { - $ip = '1.1.1.1'; - $ip2 = '2.2.2.2'; - - $server = array('HTTP_X_FORWARDED_FOR' => $ip); - $this->assertFalse(getIpAddressFromProxy($server, array($ip))); - - $server = array('HTTP_X_FORWARDED_FOR' => $ip .','. $ip2); - $this->assertEquals($ip2, getIpAddressFromProxy($server, array($ip))); - $this->assertFalse(getIpAddressFromProxy($server, array($ip, $ip2))); - } -} -- cgit v1.2.3