diff --git a/composer.json b/composer.json index 309c1c8f..805a6322 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "asyncphp/doorman": "^4" }, "require-dev": { - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^11.3", "squizlabs/php_codesniffer": "^3.7", "silverstripe/standards": "^1", "phpstan/extension-installer": "^1.3" diff --git a/tests/Jobs/DoormanQueuedJobTaskTest.php b/tests/Jobs/DoormanQueuedJobTaskTest.php index 3b5014e0..ab1aebc6 100644 --- a/tests/Jobs/DoormanQueuedJobTaskTest.php +++ b/tests/Jobs/DoormanQueuedJobTaskTest.php @@ -6,16 +6,17 @@ use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor; use Symbiote\QueuedJobs\Jobs\DoormanQueuedJobTask; use Symbiote\QueuedJobs\Services\QueuedJob; +use PHPUnit\Framework\Attributes\DataProvider; class DoormanQueuedJobTaskTest extends SapphireTest { protected static $fixture_file = 'DoormanQueuedJobTaskTest.yml'; /** - * @dataProvider canRunTaskProvider * @param string $status * @param bool $expected */ + #[DataProvider('canRunTaskProvider')] public function testCanRunTask($status, $expected) { /** @var QueuedJobDescriptor $descriptor */ @@ -30,7 +31,7 @@ public function testCanRunTask($status, $expected) /** * @return array[] */ - public function canRunTaskProvider() + public static function canRunTaskProvider() { return [ [QueuedJob::STATUS_NEW, true], @@ -41,10 +42,10 @@ public function canRunTaskProvider() } /** - * @dataProvider isCancelledProvider * @param string $status * @param bool $expected */ + #[DataProvider('isCancelledProvider')] public function testIsCancelled($status, $expected) { /** @var QueuedJobDescriptor $descriptor */ @@ -59,7 +60,7 @@ public function testIsCancelled($status, $expected) /** * @return array[] */ - public function isCancelledProvider() + public static function isCancelledProvider() { return [ [QueuedJob::STATUS_CANCELLED, true], diff --git a/tests/MaintenanceLockTest.php b/tests/MaintenanceLockTest.php index c6dcd9d5..97b5bdc8 100644 --- a/tests/MaintenanceLockTest.php +++ b/tests/MaintenanceLockTest.php @@ -5,6 +5,7 @@ use SilverStripe\Control\Director; use SilverStripe\Core\Config\Config; use Symbiote\QueuedJobs\Services\QueuedJobService; +use PHPUnit\Framework\Attributes\DataProvider; /** * Class MaintenanceLockTest @@ -17,8 +18,8 @@ class MaintenanceLockTest extends AbstractTest * @param $lockFileEnabled * @param $fileExists * @param $lockActive - * @dataProvider maintenanceCaseProvider */ + #[DataProvider('maintenanceCaseProvider')] public function testEnableMaintenanceIfActive($lockFileEnabled, $fileExists, $lockActive) { $fileName = 'test-lock.txt'; @@ -41,7 +42,7 @@ public function testEnableMaintenanceIfActive($lockFileEnabled, $fileExists, $lo /** * @return array */ - public function maintenanceCaseProvider() + public static function maintenanceCaseProvider() { return [ [ diff --git a/tests/QueuedJobRuleTest.php b/tests/QueuedJobRuleTest.php index e1ed7574..a2535415 100644 --- a/tests/QueuedJobRuleTest.php +++ b/tests/QueuedJobRuleTest.php @@ -4,6 +4,7 @@ use SilverStripe\Dev\SapphireTest; use Symbiote\QueuedJobs\DataObjects\QueuedJobRule; +use PHPUnit\Framework\Attributes\DataProvider; class QueuedJobRuleTest extends SapphireTest { @@ -11,8 +12,8 @@ class QueuedJobRuleTest extends SapphireTest * @param string $property * @param mixed $value * @param mixed $expected - * @dataProvider ruleGetterProvider */ + #[DataProvider('ruleGetterProvider')] public function testQueueRuleGetters($property, $value, $expected) { $rule = QueuedJobRule::create(); @@ -21,7 +22,7 @@ public function testQueueRuleGetters($property, $value, $expected) $this->assertSame($expected, $rule->{$property}); } - public function ruleGetterProvider(): array + public static function ruleGetterProvider(): array { return [ ['Processes', null, 1], diff --git a/tests/QueuedJobsAdminTest.php b/tests/QueuedJobsAdminTest.php index b9bb11f4..c9669a1c 100644 --- a/tests/QueuedJobsAdminTest.php +++ b/tests/QueuedJobsAdminTest.php @@ -17,7 +17,6 @@ /** * Tests for the QueuedJobsAdmin ModelAdmin clas * - * @coversDefaultClass \Symbiote\QueuedJobs\Controllers\QueuedJobsAdmin * @package queuedjobs * @author Robbie Averill */ @@ -73,8 +72,6 @@ public function testConstructorParamsShouldBeATextarea() /** * Ensure that when a multi-line value is entered for JobParams, it is split by new line and each value * passed to the constructor of the JobType that is created by the reflection in createjob() - * - * @covers ::createjob */ public function testCreateJobWithConstructorParams() { @@ -95,9 +92,6 @@ public function testCreateJobWithConstructorParams() $this->admin->createjob($form->getData(), $form); } - /** - * @covers ::createjob - */ public function testCreateJobWithStartAfterOption() { $startTimeAfter = DBDatetime::now(); diff --git a/tests/QueuedJobsTest.php b/tests/QueuedJobsTest.php index 492ce41a..ded7d061 100644 --- a/tests/QueuedJobsTest.php +++ b/tests/QueuedJobsTest.php @@ -18,6 +18,7 @@ use Symbiote\QueuedJobs\Tests\QueuedJobsTest\TestExceptingJob; use Symbiote\QueuedJobs\Tests\QueuedJobsTest\TestQJService; use Symbiote\QueuedJobs\Tests\QueuedJobsTest\TestQueuedJob; +use PHPUnit\Framework\Attributes\DataProvider; /** * @author Marcus Nyeholt @@ -745,8 +746,8 @@ public function testGrabMutex(): void * @param array $jobs * @param int $expected * @throws ValidationException - * @dataProvider jobsProvider */ + #[DataProvider('jobsProvider')] public function testBrokenJobNotification(array $jobs, int $expected): void { /** @var QueuedJobDescriptor $descriptor */ @@ -775,8 +776,8 @@ public function testBrokenJobNotification(array $jobs, int $expected): void * @param int $expected * @throws ValidationException * @throws Exception - * @dataProvider healthCheckProvider */ + #[DataProvider('healthCheckProvider')] public function testExcludeTasksFromHealthCheck(string $jobClass, int $expected): void { $service = $this->getService(); @@ -801,7 +802,7 @@ public function testExcludeTasksFromHealthCheck(string $jobClass, int $expected) ); } - public function jobsProvider(): array + public static function jobsProvider(): array { return [ [ @@ -823,7 +824,7 @@ public function jobsProvider(): array ]; } - public function healthCheckProvider(): array + public static function healthCheckProvider(): array { return [ [TestExceptingJob::class, 1],