mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 17:44:44 +08:00
Add API test for dynamic IP-based redirects
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user