@@ -257,7 +257,7 @@ public function testCollectionTypeKeepAsListOptionTrue()
257
257
{
258
258
$ formMetadata = new ClassMetadata (Form::class);
259
259
$ authorMetadata = (new ClassMetadata (Author::class))
260
- ->addPropertyConstraint ('firstName ' , new NotBlank ( ));
260
+ ->addPropertyConstraint ('firstName ' , new Length ( 1 ));
261
261
$ organizationMetadata = (new ClassMetadata (Organization::class))
262
262
->addPropertyConstraint ('authors ' , new Valid ());
263
263
$ metadataFactory = $ this ->createMock (MetadataFactoryInterface::class);
@@ -301,22 +301,22 @@ public function testCollectionTypeKeepAsListOptionTrue()
301
301
$ form ->submit ([
302
302
'authors ' => [
303
303
0 => [
304
- 'firstName ' => '' , // Fires a Not Blank Error
304
+ 'firstName ' => 'foobar ' , // Fires a Length Error
305
305
'lastName ' => 'lastName1 ' ,
306
306
],
307
307
// key "1" could be missing if we add 4 blank form entries and then remove it.
308
308
2 => [
309
- 'firstName ' => '' , // Fires a Not Blank Error
309
+ 'firstName ' => 'barfoo ' , // Fires a Length Error
310
310
'lastName ' => 'lastName3 ' ,
311
311
],
312
312
3 => [
313
- 'firstName ' => '' , // Fires a Not Blank Error
313
+ 'firstName ' => 'barbaz ' , // Fires a Length Error
314
314
'lastName ' => 'lastName3 ' ,
315
315
],
316
316
],
317
317
]);
318
318
319
- // Form does have 3 not blank errors
319
+ // Form does have 3 length errors
320
320
$ errors = $ form ->getErrors (true );
321
321
$ this ->assertCount (3 , $ errors );
322
322
@@ -328,12 +328,15 @@ public function testCollectionTypeKeepAsListOptionTrue()
328
328
];
329
329
330
330
$ this ->assertTrue ($ form ->get ('authors ' )->has ('0 ' ));
331
+ $ this ->assertSame ('foobar ' , $ form ->get ('authors ' )->get ('0 ' )->getData ()->firstName );
331
332
$ this ->assertContains ('data.authors[0].firstName ' , $ errorPaths );
332
333
333
334
$ this ->assertTrue ($ form ->get ('authors ' )->has ('1 ' ));
335
+ $ this ->assertSame ('barfoo ' , $ form ->get ('authors ' )->get ('1 ' )->getData ()->firstName );
334
336
$ this ->assertContains ('data.authors[1].firstName ' , $ errorPaths );
335
337
336
338
$ this ->assertTrue ($ form ->get ('authors ' )->has ('2 ' ));
339
+ $ this ->assertSame ('barbaz ' , $ form ->get ('authors ' )->get ('2 ' )->getData ()->firstName );
337
340
$ this ->assertContains ('data.authors[2].firstName ' , $ errorPaths );
338
341
339
342
$ this ->assertFalse ($ form ->get ('authors ' )->has ('3 ' ));
0 commit comments