3namespace tests\Udger\Helper;
24 protected function _before()
26 $this->
object =
new IP();
29 public function testInterface()
31 $this->assertInstanceOf(
"Udger\Helper\IPInterface", $this->
object);
34 public function testGetInvalidIpVerison()
36 $this->assertFalse($this->object->getIpVersion(
"banana"));
39 public function testGetEmptyIpVerison()
41 $this->assertFalse($this->object->getIpVersion(
""));
44 public function testGetValidIpVerison()
46 $this->assertEquals(4, $this->object->getIpVersion(
"0.0.0.0"));
47 $this->assertEquals(4, $this->object->getIpVersion(
"127.0.0.1"));
50 public function testGetValidIp6LoopbackVerison()
52 $this->assertEquals(6, $this->object->getIpVersion(
"::1"));
55 public function testGetValidIp6Verison()
57 $this->assertEquals(6, $this->object->getIpVersion(
"FE80:CD00:0000:0CDE:1257:0000:211E:729C"));
58 $this->assertEquals(6, $this->object->getIpVersion(
"FE80:CD00:0:CDE:1257:0:211E:729C"));
61 public function testGetIpLong()
63 $this->assertEquals(0, $this->object->getIpLong(
"0.0.0.0"));