File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -403,13 +403,12 @@ checks that all application URLs load successfully::
403403 // tests/ApplicationAvailabilityFunctionalTest.php
404404 namespace App\Tests;
405405
406+ use PHPUnit\Framework\Attributes\DataProvider;
406407 use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
407-
408+
408409 class ApplicationAvailabilityFunctionalTest extends WebTestCase
409410 {
410- /**
411- * @dataProvider urlProvider
412- */
411+ #[DataProvider('urlProvider')]
413412 public function testPageIsSuccessful($url): void
414413 {
415414 $client = self::createClient();
@@ -418,7 +417,7 @@ checks that all application URLs load successfully::
418417 $this->assertResponseIsSuccessful();
419418 }
420419
421- public function urlProvider(): \Generator
420+ public static function urlProvider(): \Generator
422421 {
423422 yield ['/'];
424423 yield ['/posts'];
Original file line number Diff line number Diff line change @@ -563,6 +563,7 @@ class to simplify writing unit tests for your custom constraints::
563563
564564 use App\Validator\ContainsAlphanumeric;
565565 use App\Validator\ContainsAlphanumericValidator;
566+ use PHPUnit\Framework\Attributes\DataProvider;
566567 use Symfony\Component\Validator\ConstraintValidatorInterface;
567568 use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
568569
@@ -580,9 +581,7 @@ class to simplify writing unit tests for your custom constraints::
580581 $this->assertNoViolation();
581582 }
582583
583- /**
584- * @dataProvider provideInvalidConstraints
585- */
584+ #[DataProvider('provideInvalidConstraints')]
586585 public function testTrueIsInvalid(ContainsAlphanumeric $constraint): void
587586 {
588587 $this->validator->validate('...', $constraint);
@@ -592,7 +591,7 @@ class to simplify writing unit tests for your custom constraints::
592591 ->assertRaised();
593592 }
594593
595- public function provideInvalidConstraints(): \Generator
594+ public static function provideInvalidConstraints(): \Generator
596595 {
597596 yield [new ContainsAlphanumeric(message: 'myMessage')];
598597 // ...
You can’t perform that action at this time.
0 commit comments