| @@ 21-29 (lines=9) @@ | ||
| 18 | ||
| 19 | class IPv4Test extends TestCase |
|
| 20 | { |
|
| 21 | public function testIpv4IntValid() |
|
| 22 | { |
|
| 23 | $defNr = 1527088647; |
|
| 24 | $this->assertTrue(IPv4::isValid($defNr, false)); |
|
| 25 | $res = new IPv4($defNr); |
|
| 26 | $this->assertEquals('91.5.134.7', $res->get()); |
|
| 27 | $this->assertEquals('091.005.134.007', $res->getLeadingZeros()); |
|
| 28 | $this->assertEquals(1527088647, $res->getLong()); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function testIpv4StringValid() |
|
| 32 | { |
|
| @@ 31-39 (lines=9) @@ | ||
| 28 | $this->assertEquals(1527088647, $res->getLong()); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function testIpv4StringValid() |
|
| 32 | { |
|
| 33 | $defNr = '91.5.134.007'; |
|
| 34 | $this->assertTrue(IPv4::isValid($defNr, false)); |
|
| 35 | $res = IPv4::create($defNr); |
|
| 36 | $this->assertEquals('91.5.134.7', $res->get()); |
|
| 37 | $this->assertEquals('091.005.134.007', $res->getLeadingZeros()); |
|
| 38 | $this->assertEquals(1527088647, $res->getLong()); |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @expectedException \mrcnpdlk\Validator\Exception |
|
| @@ 21-29 (lines=9) @@ | ||
| 18 | ||
| 19 | class PnaTest extends TestCase |
|
| 20 | { |
|
| 21 | public function testPnaValidShort() |
|
| 22 | { |
|
| 23 | $defNr = '90019'; |
|
| 24 | $this->assertTrue(Pna::isValid($defNr, false)); |
|
| 25 | $res = new Pna($defNr); |
|
| 26 | $this->assertEquals('90019', $res->get()); |
|
| 27 | $this->assertEquals('90019', $res->getShort()); |
|
| 28 | $this->assertEquals('90-019', $res->getLong()); |
|
| 29 | } |
|
| 30 | public function testPnaValidLong() |
|
| 31 | { |
|
| 32 | $defNr = '90-019'; |
|
| @@ 30-38 (lines=9) @@ | ||
| 27 | $this->assertEquals('90019', $res->getShort()); |
|
| 28 | $this->assertEquals('90-019', $res->getLong()); |
|
| 29 | } |
|
| 30 | public function testPnaValidLong() |
|
| 31 | { |
|
| 32 | $defNr = '90-019'; |
|
| 33 | $this->assertTrue(Pna::isValid($defNr, false)); |
|
| 34 | $res = new Pna($defNr); |
|
| 35 | $this->assertEquals('90019', $res->get()); |
|
| 36 | $this->assertEquals('90019', $res->getShort()); |
|
| 37 | $this->assertEquals('90-019', $res->getLong()); |
|
| 38 | } |
|
| 39 | ||
| 40 | public function testCreate() |
|
| 41 | { |
|