@@ 424-432 (lines=9) @@ | ||
421 | * Tests that if we specify the source array, it overrides any values found |
|
422 | * in the $_SERVER array. |
|
423 | */ |
|
424 | public function testSourceArrayOverridesServerSuperglobal() |
|
425 | { |
|
426 | $source = array( |
|
427 | 'REMOTE_ADDR' => '24.24.24.24' |
|
428 | ); |
|
429 | $lookup = new Whip(Whip::REMOTE_ADDR, array(), array('REMOTE_ADDR' => '127.0.0.1')); |
|
430 | $this->assertNotEquals($source['REMOTE_ADDR'], $lookup->getIpAddress()); |
|
431 | $this->assertEquals($source['REMOTE_ADDR'], $lookup->getIpAddress($source)); |
|
432 | } |
|
433 | ||
434 | /** |
|
435 | * Tests that if we specify the source array through Whip::setSource, the |
|
@@ 438-447 (lines=10) @@ | ||
435 | * Tests that if we specify the source array through Whip::setSource, the |
|
436 | * class will override any values found in $_SERVER. |
|
437 | */ |
|
438 | public function testSetSourceArrayOverridesServerSuperglobal() |
|
439 | { |
|
440 | $source = array( |
|
441 | 'REMOTE_ADDR' => '24.24.24.24' |
|
442 | ); |
|
443 | $lookup = new Whip(Whip::REMOTE_ADDR, array(), array('REMOTE_ADDR' => '127.0.0.1')); |
|
444 | $this->assertNotEquals($source['REMOTE_ADDR'], $lookup->getIpAddress()); |
|
445 | $lookup->setSource($source); |
|
446 | $this->assertEquals($source['REMOTE_ADDR'], $lookup->getIpAddress()); |
|
447 | } |
|
448 | } |
|
449 |