@@ -61,7 +61,7 @@ public static function getValidValues()
61
61
/**
62
62
* @dataProvider getInvalidValues
63
63
*/
64
- public function testInvalidValues ($ value , $ expectedMessageParam, string $ expectedErrorPath )
64
+ public function testInvalidValues ($ value , $ expectedMessageParam )
65
65
{
66
66
$ constraint = new Unique ([
67
67
'message ' => 'myMessage ' ,
@@ -71,7 +71,6 @@ public function testInvalidValues($value, $expectedMessageParam, string $expecte
71
71
$ this ->buildViolation ('myMessage ' )
72
72
->setParameter ('{{ value }} ' , $ expectedMessageParam )
73
73
->setCode (Unique::IS_NOT_UNIQUE )
74
- ->atPath ($ expectedErrorPath )
75
74
->assertRaised ();
76
75
}
77
76
@@ -80,12 +79,12 @@ public static function getInvalidValues()
80
79
$ object = new \stdClass ();
81
80
82
81
return [
83
- yield 'not unique booleans ' => [[true , true ], 'true ' , ' property.path[1] ' ],
84
- yield 'not unique integers ' => [[1 , 2 , 3 , 3 ], 3 , ' property.path[3] ' ],
85
- yield 'not unique floats ' => [[0.1 , 0.2 , 0.1 ], 0.1 , ' property.path[2] ' ],
86
- yield 'not unique string ' => [['a ' , 'b ' , 'a ' ], '"a" ' , ' property.path[2] ' ],
87
- yield 'not unique arrays ' => [[[1 , 1 ], [2 , 3 ], [1 , 1 ]], 'array ' , ' property.path[2] ' ],
88
- yield 'not unique objects ' => [[$ object , $ object ], 'object ' , ' property.path[1] ' ],
82
+ yield 'not unique booleans ' => [[true , true ], 'true ' ],
83
+ yield 'not unique integers ' => [[1 , 2 , 3 , 3 ], 3 ],
84
+ yield 'not unique floats ' => [[0.1 , 0.2 , 0.1 ], 0.1 ],
85
+ yield 'not unique string ' => [['a ' , 'b ' , 'a ' ], '"a" ' ],
86
+ yield 'not unique arrays ' => [[[1 , 1 ], [2 , 3 ], [1 , 1 ]], 'array ' ],
87
+ yield 'not unique objects ' => [[$ object , $ object ], 'object ' ],
89
88
];
90
89
}
91
90
@@ -97,7 +96,6 @@ public function testInvalidValueNamed()
97
96
$ this ->buildViolation ('myMessage ' )
98
97
->setParameter ('{{ value }} ' , '3 ' )
99
98
->setCode (Unique::IS_NOT_UNIQUE )
100
- ->atPath ('property.path[3] ' )
101
99
->assertRaised ();
102
100
}
103
101
@@ -154,7 +152,6 @@ public function testExpectsNonUniqueObjects($callback)
154
152
$ this ->buildViolation ('myMessage ' )
155
153
->setParameter ('{{ value }} ' , 'array ' )
156
154
->setCode (Unique::IS_NOT_UNIQUE )
157
- ->atPath ('property.path[2] ' )
158
155
->assertRaised ();
159
156
}
160
157
@@ -179,7 +176,6 @@ public function testExpectsInvalidNonStrictComparison()
179
176
$ this ->buildViolation ('myMessage ' )
180
177
->setParameter ('{{ value }} ' , '1 ' )
181
178
->setCode (Unique::IS_NOT_UNIQUE )
182
- ->atPath ('property.path[1] ' )
183
179
->assertRaised ();
184
180
}
185
181
@@ -206,7 +202,6 @@ public function testExpectsInvalidCaseInsensitiveComparison()
206
202
$ this ->buildViolation ('myMessage ' )
207
203
->setParameter ('{{ value }} ' , '"hello" ' )
208
204
->setCode (Unique::IS_NOT_UNIQUE )
209
- ->atPath ('property.path[1] ' )
210
205
->assertRaised ();
211
206
}
212
207
@@ -251,7 +246,7 @@ public static function getInvalidFieldNames(): array
251
246
/**
252
247
* @dataProvider getInvalidCollectionValues
253
248
*/
254
- public function testInvalidCollectionValues (array $ value , array $ fields , string $ expectedMessageParam, string $ expectedErrorPath )
249
+ public function testInvalidCollectionValues (array $ value , array $ fields , string $ expectedMessageParam )
255
250
{
256
251
$ this ->validator ->validate ($ value , new Unique ([
257
252
'message ' => 'myMessage ' ,
@@ -260,7 +255,6 @@ public function testInvalidCollectionValues(array $value, array $fields, string
260
255
$ this ->buildViolation ('myMessage ' )
261
256
->setParameter ('{{ value }} ' , $ expectedMessageParam )
262
257
->setCode (Unique::IS_NOT_UNIQUE )
263
- ->atPath ($ expectedErrorPath )
264
258
->assertRaised ();
265
259
}
266
260
@@ -270,27 +264,25 @@ public static function getInvalidCollectionValues(): array
270
264
'unique string ' => [[
271
265
['lang ' => 'eng ' , 'translation ' => 'hi ' ],
272
266
['lang ' => 'eng ' , 'translation ' => 'hello ' ],
273
- ], ['lang ' ], 'array ' , ' property.path[1] ' ],
267
+ ], ['lang ' ], 'array ' ],
274
268
'unique floats ' => [[
275
269
['latitude ' => 51.509865 , 'longitude ' => -0.118092 , 'poi ' => 'capital ' ],
276
270
['latitude ' => 52.520008 , 'longitude ' => 13.404954 ],
277
271
['latitude ' => 51.509865 , 'longitude ' => -0.118092 ],
278
- ], ['latitude ' , 'longitude ' ], 'array ' , ' property.path[2] ' ],
272
+ ], ['latitude ' , 'longitude ' ], 'array ' ],
279
273
'unique int ' => [[
280
274
['id ' => 1 , 'email ' => 'bar@email.com ' ],
281
275
['id ' => 1 , 'email ' => 'foo@email.com ' ],
282
- ], ['id ' ], 'array ' , ' property.path[1] ' ],
276
+ ], ['id ' ], 'array ' ],
283
277
'unique null ' => [
284
278
[null , null ],
285
279
[],
286
280
'null ' ,
287
- 'property.path[1] ' ,
288
281
],
289
282
'unique field null ' => [
290
283
[['nullField ' => null ], ['nullField ' => null ]],
291
284
['nullField ' ],
292
285
'array ' ,
293
- 'property.path[1] ' ,
294
286
],
295
287
];
296
288
}
0 commit comments