From 5ed81ad41419d5b182d4d811a7c20ca07c54c888 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 10 Sep 2024 11:15:50 +1200 Subject: [PATCH] DEP Use PHPUnit 11 --- composer.json | 2 +- tests/php/CampaignAdminTest.php | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 7fc5100..9f68bac 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "silverstripe/vendor-plugin": "^2" }, "require-dev": { - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^11.3", "squizlabs/php_codesniffer": "^3.7", "silverstripe/asset-admin": "^3", "silverstripe/cms": "^6", diff --git a/tests/php/CampaignAdminTest.php b/tests/php/CampaignAdminTest.php index e092c8e..57b6bd9 100644 --- a/tests/php/CampaignAdminTest.php +++ b/tests/php/CampaignAdminTest.php @@ -15,6 +15,7 @@ use SilverStripe\Security\Permission; use SilverStripe\Versioned\ChangeSet; use SilverStripe\Versioned\ChangeSetItem; +use PHPUnit\Framework\Attributes\DataProvider; class CampaignAdminTest extends FunctionalTest { @@ -137,7 +138,7 @@ public function testFilters() ); } - public function readCampaignDataProvider() + public static function readCampaignDataProvider() { return [ 'valid campaign' => ['change1', 'CMS_ACCESS_CampaignAdmin', 200], @@ -147,9 +148,7 @@ public function readCampaignDataProvider() ]; } - /** - * @dataProvider readCampaignDataProvider - */ + #[DataProvider('readCampaignDataProvider')] public function testReadCampaign( string $changesetName, string $permission, @@ -162,7 +161,7 @@ public function testReadCampaign( $this->assertEquals($expectedResponseCode, $response->getStatusCode()); } - public function provideRemoveCampaignItem(): array + public static function provideRemoveCampaignItem(): array { return [ 'open campaign' => [false, false, 204], @@ -171,9 +170,7 @@ public function provideRemoveCampaignItem(): array ]; } - /** - * @dataProvider provideRemoveCampaignItem - */ + #[DataProvider('provideRemoveCampaignItem')] public function testRemoveCampaignItem( bool $isPublished, bool $isWrongID,