From a3b96bab5748b28002006780a0267f51c11cbc83 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 10 Sep 2024 11:27:33 +1200 Subject: [PATCH] DEP Use PHPUnit 11 --- composer.json | 2 +- tests/php/ExternalLinksTest.php | 7 +++---- tests/php/Model/BrokenExternalLinkTest.php | 13 +++++-------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index edd8355..f2a7045 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "silverstripe/cms": "^6" }, "require-dev": { - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^11.3", "squizlabs/php_codesniffer": "^3", "symbiote/silverstripe-queuedjobs": "^6", "silverstripe/standards": "^1", diff --git a/tests/php/ExternalLinksTest.php b/tests/php/ExternalLinksTest.php index c6dd4a6..04d76db 100644 --- a/tests/php/ExternalLinksTest.php +++ b/tests/php/ExternalLinksTest.php @@ -13,6 +13,7 @@ use SilverStripe\ExternalLinks\Tests\Stubs\ExternalLinksTestPage; use SilverStripe\ExternalLinks\Tests\Stubs\PretendLinkChecker; use SilverStripe\i18n\i18n; use SilverStripe\Reports\Report; +use PHPUnit\Framework\Attributes\DataProvider; class ExternalLinksTest extends FunctionalTest { @@ -127,7 +128,7 @@ class ExternalLinksTest extends FunctionalTest $this->assertEquals(3, BrokenExternalLinksReport::create()->sourceRecords()->count()); } - public function provideGetJobStatus(): array + public static function provideGetJobStatus(): array { return [ 'ADMIN - valid permission' => ['ADMIN', 200], @@ -136,9 +137,7 @@ class ExternalLinksTest extends FunctionalTest ]; } - /** - * @dataProvider provideGetJobStatus - */ + #[DataProvider('provideGetJobStatus')] public function testGetJobStatus( string $permission, int $expectedResponseCode diff --git a/tests/php/Model/BrokenExternalLinkTest.php b/tests/php/Model/BrokenExternalLinkTest.php index ddfeb13..770eb54 100644 --- a/tests/php/Model/BrokenExternalLinkTest.php +++ b/tests/php/Model/BrokenExternalLinkTest.php @@ -4,12 +4,11 @@ namespace SilverStripe\ExternalLinks\Tests\Model; use SilverStripe\Dev\SapphireTest; use SilverStripe\ExternalLinks\Model\BrokenExternalLink; +use PHPUnit\Framework\Attributes\DataProvider; class BrokenExternalLinkTest extends SapphireTest { - /** - * @dataProvider httpCodeProvider - */ + #[DataProvider('httpCodeProvider')] public function testGetHTTPCodeDescription(int $httpCode, string $expected) { $link = new BrokenExternalLink(); @@ -17,7 +16,7 @@ class BrokenExternalLinkTest extends SapphireTest $this->assertSame($expected, $link->getHTTPCodeDescription()); } - public function httpCodeProvider(): array + public static function httpCodeProvider(): array { return [ [200, '200 (OK)'], @@ -28,7 +27,7 @@ class BrokenExternalLinkTest extends SapphireTest ]; } - public function permissionProvider(): array + public static function permissionProvider(): array { return [ ['admin', 'ADMIN'], @@ -37,9 +36,7 @@ class BrokenExternalLinkTest extends SapphireTest ]; } - /** - * @dataProvider permissionProvider - */ + #[DataProvider('permissionProvider')] public function testCanViewReport(string $user, string $permission) { $this->logOut();