From 1b67ff60a22da25a680e9194eaafe823e40482c8 Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Thu, 19 Dec 2024 11:13:46 +0100 Subject: [PATCH] Remove references to grace period --- .../DateTime/ExpirationHelperTest.php | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/Unit/Service/TrustedCookie/DateTime/ExpirationHelperTest.php b/tests/Unit/Service/TrustedCookie/DateTime/ExpirationHelperTest.php index 394fbdfd..f8104ce8 100644 --- a/tests/Unit/Service/TrustedCookie/DateTime/ExpirationHelperTest.php +++ b/tests/Unit/Service/TrustedCookie/DateTime/ExpirationHelperTest.php @@ -36,13 +36,22 @@ public function test_is_expired(bool $isExpired, ExpirationHelper $helper, Cooki } /** - * @dataProvider gracePeriodExpectations + * @dataProvider expirationValues */ - public function test_grace_period(bool $isExpired, ExpirationHelper $helper, CookieValue $cookieValue): void + public function test_expiration_period(bool $isExpired, ExpirationHelper $helper, CookieValue $cookieValue): void { self::assertEquals($isExpired, $helper->isExpired($cookieValue)); } + public function expirationValues(): array + { + // Cookie lifetime 3600 + $helper = $this->makeExpirationHelper(3600, time()); + return [ + 'within period' => [false, $helper, $this->makeCookieValue(time() - 3600)], + 'outside period' => [true, $helper, $this->makeCookieValue(time() - 3601)], + ]; + } public function invalidTimeExpectations(): array { @@ -97,16 +106,6 @@ public function expirationExpectations(): array ]; } - public function gracePeriodExpectations(): array - { - // Cookie lifetime 3600 - $helper = $this->makeExpirationHelper(3600, time()); - return [ - 'within grace period (lower bound)' => [false, $helper, $this->makeCookieValue(time() - 3600)], - 'outside grace period' => [true, $helper, $this->makeCookieValue(time() - 3601)], - ]; - } - private function makeExpirationHelper(int $expirationTime, int $now) : ExpirationHelper { $time = new \DateTime();