From 6d20398d6248898b08cd0a130dd83be5f7495041 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 edbdd2d..f37d893 100644 --- a/tests/php/ExternalLinksTest.php +++ b/tests/php/ExternalLinksTest.php @@ -12,6 +12,7 @@ use SilverStripe\ExternalLinks\Tests\Stubs\PretendLinkChecker; use SilverStripe\i18n\i18n; use SilverStripe\Reports\Report; +use PHPUnit\Framework\Attributes\DataProvider; class ExternalLinksTest extends FunctionalTest { @@ -126,7 +127,7 @@ public function testArchivedPagesAreHiddenFromReport() $this->assertEquals(3, BrokenExternalLinksReport::create()->sourceRecords()->count()); } - public function provideGetJobStatus(): array + public static function provideGetJobStatus(): array { return [ 'ADMIN - valid permission' => ['ADMIN', 200], @@ -135,9 +136,7 @@ public function provideGetJobStatus(): array ]; } - /** - * @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 @@ 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 @@ public function testGetHTTPCodeDescription(int $httpCode, string $expected) $this->assertSame($expected, $link->getHTTPCodeDescription()); } - public function httpCodeProvider(): array + public static function httpCodeProvider(): array { return [ [200, '200 (OK)'], @@ -28,7 +27,7 @@ public function httpCodeProvider(): array ]; } - public function permissionProvider(): array + public static function permissionProvider(): array { return [ ['admin', 'ADMIN'], @@ -37,9 +36,7 @@ public function permissionProvider(): array ]; } - /** - * @dataProvider permissionProvider - */ + #[DataProvider('permissionProvider')] public function testCanViewReport(string $user, string $permission) { $this->logOut();