public function ShareaholicSeqShareCountsTest::testGetClientIp in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.3
Same name and namespace in other branches
- 8 lib/social-share-counts/seq_share_count_test.php \ShareaholicSeqShareCountsTest::testGetClientIp()
File
- lib/
social-share-counts/ seq_share_count_test.php, line 42
Class
Code
public function testGetClientIp() {
$expected = '12345';
$_SERVER['HTTP_CLIENT_IP'] = $expected;
$result = $this->share_count
->get_client_ip();
$this
->assertEquals($expected, $result);
$expected = '23456';
$_SERVER['HTTP_CLIENT_IP'] = '';
$_SERVER['HTTP_X_FORWARDED_FOR'] = $expected;
$result = $this->share_count
->get_client_ip();
$this
->assertEquals($expected, $result);
$expected = '34567';
$_SERVER['HTTP_CLIENT_IP'] = '';
$_SERVER['HTTP_X_FORWARDED_FOR'] = '';
$_SERVER['REMOTE_ADDR'] = $expected;
$result = $this->share_count
->get_client_ip();
$this
->assertEquals($expected, $result);
}