Add API test for dynamic IP-based redirects

This commit is contained in:
Alejandro Celaya
2024-07-17 20:12:56 +02:00
parent f4a7712ded
commit 626caa4afa
3 changed files with 31 additions and 0 deletions

View File

@@ -87,6 +87,17 @@ class ListRedirectRulesTest extends ApiTestCase
],
],
],
[
'longUrl' => 'https://example.com/static-ip-address',
'priority' => 6,
'conditions' => [
[
'type' => 'ip-address',
'matchKey' => null,
'matchValue' => '1.2.3.4',
],
],
],
]])]
public function returnsListOfRulesForShortUrl(string $shortCode, array $expectedRules): void
{

View File

@@ -70,6 +70,14 @@ class ShortUrlRedirectRulesFixture extends AbstractFixture implements DependentF
);
$manager->persist($iosRule);
$ipAddressRule = new ShortUrlRedirectRule(
shortUrl: $defShortUrl,
priority: 6,
longUrl: 'https://example.com/static-ip-address',
conditions: new ArrayCollection([RedirectCondition::forIpAddress('1.2.3.4')]),
);
$manager->persist($ipAddressRule);
$manager->flush();
}
}