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:
Jellyfrog
2021-11-03 14:06:34 +01:00
committed by GitHub
parent b398a5cf2c
commit adbe435de4

View File

@@ -46,7 +46,6 @@ class IpTest extends TestCase
$this->assertTrue(IP::isValid('8.8.8.8', true));
$this->assertTrue(IPv4::isValid('192.168.0.1', 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(IPv6::isValid('::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));
}
/**
* 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()
{
$this->assertEquals('192.168.0.1', IP::parse('192.168.0.1'));