fix: Wrong type.

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2023-12-07 07:54:52 +01:00
parent 5189e5bdd1
commit b9d77bb08a

View File

@@ -114,7 +114,7 @@ class AddressTest extends UnitaryTestCase
*
* @throws InvalidArgumentException
*/
public function testBinary(string $address)
public function testToBinary(string $address)
{
$binary = Address::toBinary($address);
@@ -125,7 +125,7 @@ class AddressTest extends UnitaryTestCase
/**
* @throws InvalidArgumentException
*/
public function testBinaryInvalidIpv4()
public function testToBinaryInvalidIpv4()
{
$this->expectException(InvalidArgumentException::class);
@@ -135,13 +135,48 @@ class AddressTest extends UnitaryTestCase
/**
* @throws InvalidArgumentException
*/
public function testBinaryInvalidIpv6()
public function testToBinaryInvalidIpv6()
{
$this->expectException(InvalidArgumentException::class);
Address::toBinary('1200::AB00:1234::2552:7777:1313');
}
/**
* @throws InvalidArgumentException
*/
public function testFromBinaryWithIpv4()
{
$address = self::$faker->ipv4;
$out = Address::fromBinary(inet_pton($address));
$this->assertEquals($address, $out);
}
/**
* @throws InvalidArgumentException
*/
public function testFromBinaryWithIpv6()
{
$address = self::$faker->ipv6;
$out = Address::fromBinary(inet_pton($address));
$this->assertEquals($address, $out);
}
/**
* @throws InvalidArgumentException
*/
public function testFromBinaryWithInvalidAddress()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid IP');
Address::fromBinary('something');
}
/**
* @dataProvider checkAddressProvider
*
@@ -172,6 +207,17 @@ class AddressTest extends UnitaryTestCase
$this->assertEquals($expected, Address::check($address, $inAddress, Address::cidrToDec($inMask)));
}
/**
* @throws InvalidArgumentException
*/
public function testCheckWithInvalidAddress()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid IP');
Address::check('123', '123', '123');
}
/**
* @throws InvalidArgumentException
*/