Code Duplication    Length = 9-10 lines in 2 locations

tests/WhipTest.php 2 locations

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