diff --git a/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php b/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php index 18713e00..99a2167b 100644 --- a/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php +++ b/module/CLI/test/RedirectRule/RedirectRuleHandlerTest.php @@ -117,6 +117,7 @@ class RedirectRuleHandlerTest extends TestCase 'Query param name?' => 'foo', 'Query param value?' => 'bar', 'IP address, CIDR block or wildcard-pattern (1.2.*.*)' => '1.2.3.4', + 'Country code to match?' => 'FR', default => '', }, ); @@ -165,6 +166,10 @@ class RedirectRuleHandlerTest extends TestCase true, ]; yield 'IP address' => [RedirectConditionType::IP_ADDRESS, [RedirectCondition::forIpAddress('1.2.3.4')]]; + yield 'Geolocation country code' => [ + RedirectConditionType::GEOLOCATION_COUNTRY_CODE, + [RedirectCondition::forGeolocationCountryCode('FR')], + ]; } #[Test] diff --git a/module/Core/test/RedirectRule/Entity/RedirectConditionTest.php b/module/Core/test/RedirectRule/Entity/RedirectConditionTest.php index 81b69fe5..895b8236 100644 --- a/module/Core/test/RedirectRule/Entity/RedirectConditionTest.php +++ b/module/Core/test/RedirectRule/Entity/RedirectConditionTest.php @@ -97,8 +97,11 @@ class RedirectConditionTest extends TestCase } #[Test, DataProvider('provideVisits')] - public function matchesGeolocationCountryCode(Location|null $location, string $countryCodeToMatch, bool $expected): void - { + public function matchesGeolocationCountryCode( + Location|null $location, + string $countryCodeToMatch, + bool $expected, + ): void { $request = ServerRequestFactory::fromGlobals()->withAttribute(Location::class, $location); $result = RedirectCondition::forGeolocationCountryCode($countryCodeToMatch)->matchesRequest($request);