File tree 1 file changed +13
-16
lines changed
src/Symfony/Component/Validator/Tests/Constraints
1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -99,32 +99,29 @@ public function testEmptyArrayIsInvalid()
99
99
->assertRaised ();
100
100
}
101
101
102
- /**
103
- * @dataProvider provideAllowNull
104
- */
105
- public function testAllowNull (bool $ allowNull )
102
+ public function testAllowNullTrue ()
106
103
{
107
- $ constraint = new NotBlank (array (
104
+ $ constraint = new NotBlank ([
108
105
'message ' => 'myMessage ' ,
109
- 'allowNull ' => $ allowNull ,
110
- ) );
106
+ 'allowNull ' => true ,
107
+ ] );
111
108
112
109
$ this ->validator ->validate (null , $ constraint );
110
+ $ this ->assertNoViolation ();
111
+ }
113
112
114
- if ($ allowNull ) {
115
- $ this ->assertNoViolation ();
113
+ public function testAllowNullFalse ()
114
+ {
115
+ $ constraint = new NotBlank ([
116
+ 'message ' => 'myMessage ' ,
117
+ 'allowNull ' => false ,
118
+ ]);
116
119
117
- return ;
118
- }
120
+ $ this ->validator ->validate (null , $ constraint );
119
121
120
122
$ this ->buildViolation ('myMessage ' )
121
123
->setParameter ('{{ value }} ' , 'null ' )
122
124
->setCode (NotBlank::IS_BLANK_ERROR )
123
125
->assertRaised ();
124
126
}
125
-
126
- public function provideAllowNull (): array
127
- {
128
- return array (array (true ), array (false ));
129
- }
130
127
}
You can’t perform that action at this time.
0 commit comments