mirror of
https://github.com/shlinkio/shlink.git
synced 2025-01-05 05:34:58 -06:00
Update RedirectRuleHandlerTest
This commit is contained in:
parent
b5b5f92eda
commit
f2371b6124
@ -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]
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user