@@ -45,7 +45,6 @@ public function testExpectArrayIfMultipleIsTrue()
45
45
$ constraint = new Choice (array (
46
46
'choices ' => array ('foo ' , 'bar ' ),
47
47
'multiple ' => true ,
48
- 'strict ' => true ,
49
48
));
50
49
51
50
$ this ->validator ->validate ('asdf ' , $ constraint );
@@ -58,7 +57,6 @@ public function testNullIsValid()
58
57
new Choice (
59
58
array (
60
59
'choices ' => array ('foo ' , 'bar ' ),
61
- 'strict ' => true ,
62
60
)
63
61
)
64
62
);
@@ -71,20 +69,20 @@ public function testNullIsValid()
71
69
*/
72
70
public function testChoicesOrCallbackExpected ()
73
71
{
74
- $ this ->validator ->validate ('foobar ' , new Choice (array ( ' strict ' => true ) ));
72
+ $ this ->validator ->validate ('foobar ' , new Choice ());
75
73
}
76
74
77
75
/**
78
76
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
79
77
*/
80
78
public function testValidCallbackExpected ()
81
79
{
82
- $ this ->validator ->validate ('foobar ' , new Choice (array ('callback ' => 'abcd ' , ' strict ' => true )));
80
+ $ this ->validator ->validate ('foobar ' , new Choice (array ('callback ' => 'abcd ' )));
83
81
}
84
82
85
83
public function testValidChoiceArray ()
86
84
{
87
- $ constraint = new Choice (array ('choices ' => array ('foo ' , 'bar ' ), ' strict ' => true ));
85
+ $ constraint = new Choice (array ('choices ' => array ('foo ' , 'bar ' )));
88
86
89
87
$ this ->validator ->validate ('bar ' , $ constraint );
90
88
@@ -93,7 +91,7 @@ public function testValidChoiceArray()
93
91
94
92
public function testValidChoiceCallbackFunction ()
95
93
{
96
- $ constraint = new Choice (array ('callback ' => __NAMESPACE__ .'\choice_callback ' , ' strict ' => true ));
94
+ $ constraint = new Choice (array ('callback ' => __NAMESPACE__ .'\choice_callback ' ));
97
95
98
96
$ this ->validator ->validate ('bar ' , $ constraint );
99
97
@@ -104,7 +102,6 @@ public function testValidChoiceCallbackClosure()
104
102
{
105
103
$ constraint = new Choice (
106
104
array (
107
- 'strict ' => true ,
108
105
'callback ' => function () {
109
106
return array ('foo ' , 'bar ' );
110
107
},
@@ -118,7 +115,7 @@ public function testValidChoiceCallbackClosure()
118
115
119
116
public function testValidChoiceCallbackStaticMethod ()
120
117
{
121
- $ constraint = new Choice (array ('callback ' => array (__CLASS__ , 'staticCallback ' ), ' strict ' => true ));
118
+ $ constraint = new Choice (array ('callback ' => array (__CLASS__ , 'staticCallback ' )));
122
119
123
120
$ this ->validator ->validate ('bar ' , $ constraint );
124
121
@@ -130,7 +127,7 @@ public function testValidChoiceCallbackContextMethod()
130
127
// search $this for "staticCallback"
131
128
$ this ->setObject ($ this );
132
129
133
- $ constraint = new Choice (array ('callback ' => 'staticCallback ' , ' strict ' => true ));
130
+ $ constraint = new Choice (array ('callback ' => 'staticCallback ' ));
134
131
135
132
$ this ->validator ->validate ('bar ' , $ constraint );
136
133
@@ -142,7 +139,7 @@ public function testValidChoiceCallbackContextObjectMethod()
142
139
// search $this for "objectMethodCallback"
143
140
$ this ->setObject ($ this );
144
141
145
- $ constraint = new Choice (array ('callback ' => 'objectMethodCallback ' , ' strict ' => true ));
142
+ $ constraint = new Choice (array ('callback ' => 'objectMethodCallback ' ));
146
143
147
144
$ this ->validator ->validate ('bar ' , $ constraint );
148
145
@@ -154,7 +151,6 @@ public function testMultipleChoices()
154
151
$ constraint = new Choice (array (
155
152
'choices ' => array ('foo ' , 'bar ' , 'baz ' ),
156
153
'multiple ' => true ,
157
- 'strict ' => true ,
158
154
));
159
155
160
156
$ this ->validator ->validate (array ('baz ' , 'bar ' ), $ constraint );
@@ -167,7 +163,6 @@ public function testInvalidChoice()
167
163
$ constraint = new Choice (array (
168
164
'choices ' => array ('foo ' , 'bar ' ),
169
165
'message ' => 'myMessage ' ,
170
- 'strict ' => true ,
171
166
));
172
167
173
168
$ this ->validator ->validate ('baz ' , $ constraint );
@@ -185,7 +180,6 @@ public function testInvalidChoiceEmptyChoices()
185
180
// the DB or the model
186
181
'choices ' => array (),
187
182
'message ' => 'myMessage ' ,
188
- 'strict ' => true ,
189
183
));
190
184
191
185
$ this ->validator ->validate ('baz ' , $ constraint );
@@ -202,7 +196,6 @@ public function testInvalidChoiceMultiple()
202
196
'choices ' => array ('foo ' , 'bar ' ),
203
197
'multipleMessage ' => 'myMessage ' ,
204
198
'multiple ' => true ,
205
- 'strict ' => true ,
206
199
));
207
200
208
201
$ this ->validator ->validate (array ('foo ' , 'baz ' ), $ constraint );
@@ -221,7 +214,6 @@ public function testTooFewChoices()
221
214
'multiple ' => true ,
222
215
'min ' => 2 ,
223
216
'minMessage ' => 'myMessage ' ,
224
- 'strict ' => true ,
225
217
));
226
218
227
219
$ value = array ('foo ' );
@@ -245,7 +237,6 @@ public function testTooManyChoices()
245
237
'multiple ' => true ,
246
238
'max ' => 2 ,
247
239
'maxMessage ' => 'myMessage ' ,
248
- 'strict ' => true ,
249
240
));
250
241
251
242
$ value = array ('foo ' , 'bar ' , 'moo ' );
@@ -262,27 +253,10 @@ public function testTooManyChoices()
262
253
->assertRaised ();
263
254
}
264
255
265
- /**
266
- * @group legacy
267
- */
268
- public function testNonStrict ()
269
- {
270
- $ constraint = new Choice (array (
271
- 'choices ' => array (1 , 2 ),
272
- 'strict ' => false ,
273
- ));
274
-
275
- $ this ->validator ->validate ('2 ' , $ constraint );
276
- $ this ->validator ->validate (2 , $ constraint );
277
-
278
- $ this ->assertNoViolation ();
279
- }
280
-
281
256
public function testStrictAllowsExactValue ()
282
257
{
283
258
$ constraint = new Choice (array (
284
259
'choices ' => array (1 , 2 ),
285
- 'strict ' => true ,
286
260
));
287
261
288
262
$ this ->validator ->validate (2 , $ constraint );
@@ -294,7 +268,6 @@ public function testStrictDisallowsDifferentType()
294
268
{
295
269
$ constraint = new Choice (array (
296
270
'choices ' => array (1 , 2 ),
297
- 'strict ' => true ,
298
271
'message ' => 'myMessage ' ,
299
272
));
300
273
@@ -306,28 +279,11 @@ public function testStrictDisallowsDifferentType()
306
279
->assertRaised ();
307
280
}
308
281
309
- /**
310
- * @group legacy
311
- */
312
- public function testNonStrictWithMultipleChoices ()
313
- {
314
- $ constraint = new Choice (array (
315
- 'choices ' => array (1 , 2 , 3 ),
316
- 'multiple ' => true ,
317
- 'strict ' => false ,
318
- ));
319
-
320
- $ this ->validator ->validate (array ('2 ' , 3 ), $ constraint );
321
-
322
- $ this ->assertNoViolation ();
323
- }
324
-
325
282
public function testStrictWithMultipleChoices ()
326
283
{
327
284
$ constraint = new Choice (array (
328
285
'choices ' => array (1 , 2 , 3 ),
329
286
'multiple ' => true ,
330
- 'strict ' => true ,
331
287
'multipleMessage ' => 'myMessage ' ,
332
288
));
333
289
0 commit comments