From bab6a3951ef91bb63f23a05e822b030ddae33ea9 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 17 Jul 2024 19:56:53 +0200 Subject: [PATCH] Add missing unit test --- module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php | 2 ++ module/Core/src/Util/IpAddressUtils.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php b/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php index 0c0b7d12..edd1eae3 100644 --- a/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php +++ b/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php @@ -116,6 +116,7 @@ class RedirectRuleHandlerTest extends TestCase 'Language to match?' => 'en-US', 'Query param name?' => 'foo', 'Query param value?' => 'bar', + 'IP address, CIDR block or wildcard-pattern (1.2.*.*)' => '1.2.3.4', default => '', }, ); @@ -163,6 +164,7 @@ class RedirectRuleHandlerTest extends TestCase [RedirectCondition::forQueryParam('foo', 'bar'), RedirectCondition::forQueryParam('foo', 'bar')], true, ]; + yield 'IP address' => [RedirectConditionType::IP_ADDRESS, [RedirectCondition::forIpAddress('1.2.3.4')]]; } #[Test] diff --git a/module/Core/src/Util/IpAddressUtils.php b/module/Core/src/Util/IpAddressUtils.php index 79e7f839..f5e1b052 100644 --- a/module/Core/src/Util/IpAddressUtils.php +++ b/module/Core/src/Util/IpAddressUtils.php @@ -26,7 +26,7 @@ final class IpAddressUtils * Matching will happen as follows: * * Static IP address -> strict equality with provided IP address. * * CIDR block -> provided IP address is part of that block. - * * Wildcard -> static parts match the corresponding ones in provided IP address. + * * Wildcard pattern -> static parts match the corresponding ones in provided IP address. * * @param string[] $groups * @throws InvalidIpFormatException