mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix IPV6 test (#13468)
The test checks if 2001:db8... is a valid ipv6 *not* in reserved ranges. A bug in PHP (https://bugs.php.net/bug.php?id=61700) made it wrongly pass.
This commit is contained in:
@@ -46,7 +46,6 @@ class IpTest extends TestCase
|
|||||||
$this->assertTrue(IP::isValid('8.8.8.8', true));
|
$this->assertTrue(IP::isValid('8.8.8.8', true));
|
||||||
$this->assertTrue(IPv4::isValid('192.168.0.1', true));
|
$this->assertTrue(IPv4::isValid('192.168.0.1', true));
|
||||||
$this->assertTrue(IPv6::isValid('FF81::', true));
|
$this->assertTrue(IPv6::isValid('FF81::', true));
|
||||||
$this->assertTrue(IPv6::isValid('2001:db8:85a3::8a2e:370:7334', true));
|
|
||||||
$this->assertFalse(IPv4::isValid('127.0.0.1', true));
|
$this->assertFalse(IPv4::isValid('127.0.0.1', true));
|
||||||
$this->assertFalse(IPv6::isValid('::1', true));
|
$this->assertFalse(IPv6::isValid('::1', true));
|
||||||
$this->assertFalse(IP::isValid('169.254.1.1', true));
|
$this->assertFalse(IP::isValid('169.254.1.1', true));
|
||||||
@@ -55,6 +54,16 @@ class IpTest extends TestCase
|
|||||||
$this->assertFalse(IP::isValid('Falafel', true));
|
$this->assertFalse(IP::isValid('Falafel', true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See https://github.com/librenms/librenms/pull/13468 for more info
|
||||||
|
*
|
||||||
|
* @requires PHP >= 7.4
|
||||||
|
*/
|
||||||
|
public function testIsValidIPv6ExcludeReserved(): void
|
||||||
|
{
|
||||||
|
$this->assertFalse(IPv6::isValid('2001:db8:85a3::8a2e:370:7334', true));
|
||||||
|
}
|
||||||
|
|
||||||
public function testIpParse()
|
public function testIpParse()
|
||||||
{
|
{
|
||||||
$this->assertEquals('192.168.0.1', IP::parse('192.168.0.1'));
|
$this->assertEquals('192.168.0.1', IP::parse('192.168.0.1'));
|
||||||
|
Reference in New Issue
Block a user