From 7110d6683e8f16151f6e256af47cf1e577725d6e Mon Sep 17 00:00:00 2001 From: Felix Jacobi Date: Thu, 17 Mar 2022 03:59:06 +0100 Subject: [PATCH] Updated SetCookieTest to pull fix from Guzzle --- tests/unit/Http/SetCookieTest.php | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/tests/unit/Http/SetCookieTest.php b/tests/unit/Http/SetCookieTest.php index 919ebe2f..f6cb7000 100644 --- a/tests/unit/Http/SetCookieTest.php +++ b/tests/unit/Http/SetCookieTest.php @@ -170,10 +170,6 @@ public function pathMatchProvider(): array /** * @dataProvider pathMatchProvider - * - * @param string $cookiePath - * @param string $requestPath - * @param bool $isMatch */ public function testMatchesPath(string $cookiePath, string $requestPath, bool $isMatch): void { @@ -199,9 +195,6 @@ public function cookieValidateProvider(): array /** * @dataProvider cookieValidateProvider * - * @param string $name - * @param string|null $value - * @param string $domain * @param bool|string $result */ public function testValidatesCookies(string $name, ?string $value, string $domain, $result): void @@ -399,28 +392,19 @@ public function cookieParserDataProvider(): array /** * @dataProvider cookieParserDataProvider - * - * @param string|array $cookie - * @param array $parsed */ - public function testParseCookie($cookie, array $parsed): void + public function testParseCookie(string $cookie, array $parsed): void { - if (\PHP_VERSION_ID >= 80000) { - self::markTestSkipped('This test is possibly using incorrect code and is broken starting from PHP 8. ' . - 'See https://github.com/littleredbutton/bigbluebutton-api-php/pull/70#discussion_r637602067 and ' . - 'https://github.com/guzzle/guzzle/issues/2894 for details.'); - } - foreach ((array) $cookie as $v) { $c = SetCookie::fromString($v); $p = $c->toArray(); if (isset($p['Expires'])) { - // Remove expires values from the assertion if they are relatively equal - if (\abs($p['Expires'] != \strtotime((string) $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)) { @@ -479,9 +463,6 @@ public function isExpiredProvider(): array /** * @dataProvider isExpiredProvider - * - * @param string $cookie - * @param bool $expired */ public function testIsExpired(string $cookie, bool $expired): void {