Skip to content

Commit

Permalink
Remove references to grace period
Browse files Browse the repository at this point in the history
  • Loading branch information
johanib committed Dec 19, 2024
1 parent 57870f1 commit baa29b0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions tests/Unit/Service/TrustedCookie/DateTime/ExpirationHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit baa29b0

Please sign in to comment.