Skip to content

Commit

Permalink
Fix comparison in testParseCookie (#2977)
Browse files Browse the repository at this point in the history
  • Loading branch information
villfa committed Mar 13, 2022
1 parent d12ecb1 commit 802ecc6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/Cookie/SetCookieTest.php
Expand Up @@ -373,11 +373,11 @@ public function testParseCookie($cookie, $parsed)
$p = $c->toArray();

if (isset($p['Expires'])) {
// Remove expires values from the assertion if they are relatively equal
if (\abs($p['Expires'] != \strtotime($parsed['Expires'])) < 40) {
unset($p['Expires']);
unset($parsed['Expires']);
}
$delta = 40;
$parsedExpires = \is_numeric($parsed['Expires']) ? $parsed['Expires'] : \strtotime($parsed['Expires']);
self::assertLessThan($delta, \abs($p['Expires'] - $parsedExpires), 'Comparing Expires ' . \var_export($p['Expires'], true) . ' : ' . \var_export($parsed, true) . ' | ' . \var_export($p, true));
unset($p['Expires']);
unset($parsed['Expires']);
}

if (!empty($parsed)) {
Expand Down

0 comments on commit 802ecc6

Please sign in to comment.