Skip to content

Commit

Permalink
PHPUnit 10 (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Apr 25, 2023
1 parent de46c46 commit 4055c60
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -33,7 +33,7 @@
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.20",
"phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"spiral/http": "^3.8",
"nyholm/psr7": "^1.5",
Expand Down
37 changes: 14 additions & 23 deletions tests/CookieTest.php
Expand Up @@ -4,6 +4,7 @@

namespace Spiral\Tests\Cookies;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Cookies\Cookie;

Expand Down Expand Up @@ -109,13 +110,8 @@ public function testPack(): void
);
}

/**
* @dataProvider sameSiteProvider
* @param $expected
* @param bool $secure
* @param string|null $sameSite
*/
public function testSameSite($expected, bool $secure, ?string $sameSite): void
#[DataProvider('sameSiteProvider')]
public function testSameSite(?string $expected, bool $secure, ?string $sameSite): void
{
$cookie = new Cookie('', '', 0, '', '', $secure, false, $sameSite);
$this->assertSame($expected, $cookie->getSameSite());
Expand All @@ -127,22 +123,17 @@ public function testSameSite($expected, bool $secure, ?string $sameSite): void
}
}

/**
* @return iterable
*/
public function sameSiteProvider(): iterable
public static function sameSiteProvider(): \Traversable
{
return [
[null, true, null],
[null, false, null],
[null, true, 'weird'],
[null, false, 'weird'],
['Lax', true, 'lax'],
['Lax', false, 'lax'],
['Strict', true, 'strict'],
['Strict', false, 'strict'],
['None', true, 'none'],
['Lax', false, 'none'],
];
yield [null, true, null];
yield [null, false, null];
yield [null, true, 'weird'];
yield [null, false, 'weird'];
yield ['Lax', true, 'lax'];
yield ['Lax', false, 'lax'];
yield ['Strict', true, 'strict'];
yield ['Strict', false, 'strict'];
yield ['None', true, 'none'];
yield ['Lax', false, 'none'];
}
}

0 comments on commit 4055c60

Please sign in to comment.