File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -88,13 +88,13 @@ public function testGetOrAddValidatorByType(): void
8888 // Confirm validator starts empty.
8989 $ this ->assertCount (0 , $ compositeValidator ->getValidators ());
9090 // One validator should be created and added.
91- $ simpleFieldsValidator1 = $ compositeValidator ->getOrAddValidatorByType (SimpleFieldsValidator ::class); // @TODO replace with another
91+ $ validator1 = $ compositeValidator ->getOrAddValidatorByType (WarningFieldsValidator ::class);
9292 $ this ->assertCount (1 , $ compositeValidator ->getValidators ());
9393 // The validator previously created should be fetched, rather than instantiating a new one.
94- $ simpleFieldsValidator2 = $ compositeValidator ->getOrAddValidatorByType (SimpleFieldsValidator ::class); // @TODO replace with another
94+ $ validator2 = $ compositeValidator ->getOrAddValidatorByType (WarningFieldsValidator ::class);
9595 $ this ->assertCount (1 , $ compositeValidator ->getValidators ());
9696 // Confirm both simple fields validators are the exact same instance.
97- $ this ->assertTrue ($ simpleFieldsValidator1 === $ simpleFieldsValidator2 );
97+ $ this ->assertTrue ($ validator1 === $ validator2 );
9898 }
9999
100100 /**
Original file line number Diff line number Diff line change 22
33namespace Signify \ComposableValidators \Tests ;
44
5+ use PHPUnit \Framework \Attributes \DataProvider ;
56use Signify \ComposableValidators \Validators \ConstraintsValidator ;
67use SilverStripe \Dev \SapphireTest ;
78use Symfony \Component \Validator \Constraints \Ip ;
89use Symfony \Component \Validator \Constraints \NotBlank ;
910
1011class ConstraintsValidatorTest extends SapphireTest
1112{
12- public function provideValidation (): array
13+ public static function provideValidation (): array
1314 {
1415 return [
1516 [
@@ -25,9 +26,7 @@ public function provideValidation(): array
2526 ];
2627 }
2728
28- /**
29- * @dataProvider provideValidation
30- */
29+ #[DataProvider('provideValidation ' )]
3130 public function testValidation (array $ fields , array $ constraints , bool $ isValid ): void
3231 {
3332 $ form = TestFormGenerator::getForm ($ fields , new ConstraintsValidator ($ constraints ));
You can’t perform that action at this time.
0 commit comments