$subnet = '2a01:198:603:0::/65';
$this->
assertFalse(IpUtils::
checkIp4($ip,
$subnet));
$this->
assertTrue(IpUtils::
checkIp6($ip,
$subnet));
} /**
* @dataProvider getIpv4Data
*/
public function testIpv4($matches,
$remoteAddr,
$cidr) { $this->
assertSame($matches, IpUtils::
checkIp($remoteAddr,
$cidr));
} public static function getIpv4Data() { return [ [true, '192.168.1.1', '192.168.1.1'
],
[true, '192.168.1.1', '192.168.1.1/1'
],
[true, '192.168.1.1', '192.168.1.0/24'
],
[false, '192.168.1.1', '1.2.3.4/1'
],
[false, '192.168.1.1', '192.168.1.1/33'
], // invalid subnet
[true, '192.168.1.1',
['1.2.3.4/1', '192.168.1.0/24'
]],
[