|
@@ 360-371 (lines=12) @@
|
| 357 |
|
* Tests that if we specify the source array, it overrides any values found |
| 358 |
|
* in the $_SERVER array. |
| 359 |
|
*/ |
| 360 |
|
public function testSourceArrayOverridesServerSuperglobal() |
| 361 |
|
{ |
| 362 |
|
$_SERVER = array( |
| 363 |
|
'REMOTE_ADDR' => '127.0.0.1' |
| 364 |
|
); |
| 365 |
|
$source = array( |
| 366 |
|
'REMOTE_ADDR' => '24.24.24.24' |
| 367 |
|
); |
| 368 |
|
$lookup = new Whip(Whip::REMOTE_ADDR); |
| 369 |
|
$this->assertNotEquals($source['REMOTE_ADDR'], $lookup->getIpAddress()); |
| 370 |
|
$this->assertEquals($source['REMOTE_ADDR'], $lookup->getIpAddress($source)); |
| 371 |
|
} |
| 372 |
|
|
| 373 |
|
/** |
| 374 |
|
* Tests that if we specify the source array through Whip::setSource, the |
|
@@ 377-389 (lines=13) @@
|
| 374 |
|
* Tests that if we specify the source array through Whip::setSource, the |
| 375 |
|
* class will override any values found in $_SERVER. |
| 376 |
|
*/ |
| 377 |
|
public function testSetSourceArrayOverridesServerSuperglobal() |
| 378 |
|
{ |
| 379 |
|
$_SERVER = array( |
| 380 |
|
'REMOTE_ADDR' => '127.0.0.1' |
| 381 |
|
); |
| 382 |
|
$source = array( |
| 383 |
|
'REMOTE_ADDR' => '24.24.24.24' |
| 384 |
|
); |
| 385 |
|
$lookup = new Whip(Whip::REMOTE_ADDR); |
| 386 |
|
$this->assertNotEquals($source['REMOTE_ADDR'], $lookup->getIpAddress()); |
| 387 |
|
$lookup->setSource($source); |
| 388 |
|
$this->assertEquals($source['REMOTE_ADDR'], $lookup->getIpAddress()); |
| 389 |
|
} |
| 390 |
|
} |
| 391 |
|
|