@@ -257,7 +257,7 @@ public function testCollectionTypeKeepAsListOptionTrue()
257257 {
258258 $ formMetadata = new ClassMetadata (Form::class);
259259 $ authorMetadata = (new ClassMetadata (Author::class))
260- ->addPropertyConstraint ('firstName ' , new NotBlank ( ));
260+ ->addPropertyConstraint ('firstName ' , new Length ( 1 ));
261261 $ organizationMetadata = (new ClassMetadata (Organization::class))
262262 ->addPropertyConstraint ('authors ' , new Valid ());
263263 $ metadataFactory = $ this ->createMock (MetadataFactoryInterface::class);
@@ -301,22 +301,22 @@ public function testCollectionTypeKeepAsListOptionTrue()
301301 $ form ->submit ([
302302 'authors ' => [
303303 0 => [
304- 'firstName ' => '' , // Fires a Not Blank Error
304+ 'firstName ' => 'foobar ' , // Fires a Length Error
305305 'lastName ' => 'lastName1 ' ,
306306 ],
307307 // key "1" could be missing if we add 4 blank form entries and then remove it.
308308 2 => [
309- 'firstName ' => '' , // Fires a Not Blank Error
309+ 'firstName ' => 'barfoo ' , // Fires a Length Error
310310 'lastName ' => 'lastName3 ' ,
311311 ],
312312 3 => [
313- 'firstName ' => '' , // Fires a Not Blank Error
313+ 'firstName ' => 'barbaz ' , // Fires a Length Error
314314 'lastName ' => 'lastName3 ' ,
315315 ],
316316 ],
317317 ]);
318318
319- // Form does have 3 not blank errors
319+ // Form does have 3 length errors
320320 $ errors = $ form ->getErrors (true );
321321 $ this ->assertCount (3 , $ errors );
322322
@@ -328,12 +328,15 @@ public function testCollectionTypeKeepAsListOptionTrue()
328328 ];
329329
330330 $ this ->assertTrue ($ form ->get ('authors ' )->has ('0 ' ));
331+ $ this ->assertSame ('foobar ' , $ form ->get ('authors ' )->get ('0 ' )->getData ()->firstName );
331332 $ this ->assertContains ('data.authors[0].firstName ' , $ errorPaths );
332333
333334 $ this ->assertTrue ($ form ->get ('authors ' )->has ('1 ' ));
335+ $ this ->assertSame ('barfoo ' , $ form ->get ('authors ' )->get ('1 ' )->getData ()->firstName );
334336 $ this ->assertContains ('data.authors[1].firstName ' , $ errorPaths );
335337
336338 $ this ->assertTrue ($ form ->get ('authors ' )->has ('2 ' ));
339+ $ this ->assertSame ('barbaz ' , $ form ->get ('authors ' )->get ('2 ' )->getData ()->firstName );
337340 $ this ->assertContains ('data.authors[2].firstName ' , $ errorPaths );
338341
339342 $ this ->assertFalse ($ form ->get ('authors ' )->has ('3 ' ));
0 commit comments