|
@@ 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->getAsInt()); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
public function testIpv4StringValid() |
| 32 |
|
{ |
|
@@ 31-39 (lines=9) @@
|
| 28 |
|
$this->assertEquals(1527088647, $res->getAsInt()); |
| 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->getAsInt()); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
/** |
| 42 |
|
* @expectedException \mrcnpdlk\Validator\Exception |