-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathIpTest.php
More file actions
31 lines (25 loc) · 862 Bytes
/
IpTest.php
File metadata and controls
31 lines (25 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace Rakit\Validation\Tests\Rules;
use Rakit\Validation\Rules\Ip;
use PHPUnit\Framework\TestCase;
class IpTest extends TestCase
{
public function setUp()
{
$this->rule = new Ip;
}
public function testValids()
{
$this->assertTrue($this->rule->check('1.2.3.4'));
$this->assertTrue($this->rule->check('255.255.255.255'));
$this->assertTrue($this->rule->check('ff02::2'));
$this->assertTrue($this->rule->check('2001:0000:3238:DFE1:0063:0000:0000:FEFB'));
}
public function testInvalids()
{
$this->assertFalse($this->rule->check('1.2.3.4.5'));
$this->assertFalse($this->rule->check('256.255.255.255'));
$this->assertFalse($this->rule->check('hf02::2'));
$this->assertFalse($this->rule->check('12345:0000:3238:DFE1:0063:0000:0000:FEFB'));
}
}