6 namespace Shaarli\Http
;
8 require_once 'application/http/HttpUtils.php';
11 * Unitary tests for client_ip_id()
13 class ClientIpIdTest
extends \PHPUnit\Framework\TestCase
16 * Get a remote client ID based on its IP
18 public function testClientIpIdRemote()
22 client_ip_id(['REMOTE_ADDR' => '10.1.167.42'])
27 * Get a remote client ID based on its IP and proxy information (1)
29 public function testClientIpIdRemoteForwarded()
32 '10.1.167.42_127.0.1.47',
34 'REMOTE_ADDR' => '10.1.167.42',
35 'HTTP_X_FORWARDED_FOR' => '127.0.1.47'
41 * Get a remote client ID based on its IP and proxy information (2)
43 public function testClientIpIdRemoteForwardedClient()
46 '10.1.167.42_10.1.167.56_127.0.1.47',
48 'REMOTE_ADDR' => '10.1.167.42',
49 'HTTP_X_FORWARDED_FOR' => '10.1.167.56',
50 'HTTP_CLIENT_IP' => '127.0.1.47'