From 4055c60b75f159cca7b6614654cb0d07872fd102 Mon Sep 17 00:00:00 2001 From: spiralbot Date: Tue, 25 Apr 2023 17:32:09 +0000 Subject: [PATCH] PHPUnit 10 (#927) --- composer.json | 2 +- tests/CookieTest.php | 37 ++++++++++++++----------------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/composer.json b/composer.json index d359879c..baaa8781 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/tests/CookieTest.php b/tests/CookieTest.php index b8148a17..af3923ee 100644 --- a/tests/CookieTest.php +++ b/tests/CookieTest.php @@ -4,6 +4,7 @@ namespace Spiral\Tests\Cookies; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Spiral\Cookies\Cookie; @@ -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()); @@ -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']; } }