mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Support for redirects with a condition before date
This commit is contained in:
committed by
Alejandro Celaya
parent
77898d1edc
commit
dae52fedf4
@@ -122,6 +122,9 @@ class RedirectRuleHandler implements RedirectRuleHandlerInterface
|
||||
),
|
||||
RedirectConditionType::GEOLOCATION_CITY_NAME => RedirectCondition::forGeolocationCityName(
|
||||
$this->askMandatory('City name to match?', $io),
|
||||
),
|
||||
RedirectConditionType::BEFORE_DATE => RedirectCondition::forBeforeDate(
|
||||
$this->askMandatory('Date to match? (ISO 8601)', $io),
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ class RedirectRuleHandlerTest extends TestCase
|
||||
'IP address, CIDR block or wildcard-pattern (1.2.*.*)' => '1.2.3.4',
|
||||
'Country code to match?' => 'FR',
|
||||
'City name to match?' => 'Los angeles',
|
||||
'Date to match? (ISO 8601)' => '2016-05-01T20:34:16+02:00',
|
||||
default => '',
|
||||
},
|
||||
);
|
||||
@@ -186,6 +187,10 @@ class RedirectRuleHandlerTest extends TestCase
|
||||
RedirectConditionType::GEOLOCATION_CITY_NAME,
|
||||
[RedirectCondition::forGeolocationCityName('Los angeles')],
|
||||
];
|
||||
yield 'Before date' => [
|
||||
RedirectConditionType::BEFORE_DATE,
|
||||
[RedirectCondition::forBeforeDate('2016-05-01T20:34:16+02:00')],
|
||||
];
|
||||
}
|
||||
|
||||
#[Test]
|
||||
|
||||
Reference in New Issue
Block a user