File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ public function buildForm()
6363 ->add ('body ' , 'textarea ' );
6464 }
6565
66+ public function alterFieldValues (array &$ values )
67+ {
68+ $ values ['body ' ] = strtoupper ($ values ['body ' ]);
69+ }
70+
6671 public function alterValid (Form $ mainForm , &$ isValid )
6772 {
6873 $ values = $ this ->getFieldValues ();
@@ -88,6 +93,15 @@ public function buildForm()
8893 $ this ->add ('subcustom ' , 'form ' , [
8994 'class ' => CustomDummyForm::class,
9095 ]);
96+
97+ $ this ->add ('subcustom_collection ' , 'collection ' , [
98+ 'type ' => 'form ' ,
99+ 'empty_row ' => true ,
100+ 'prefer_input ' => true ,
101+ 'options ' => [
102+ 'class ' => CustomDummyForm::class,
103+ ],
104+ ]);
91105 }
92106
93107 public function alterFieldValues (array &$ values )
Original file line number Diff line number Diff line change @@ -349,16 +349,24 @@ public function it_returns_field_values()
349349 /** @test */
350350 public function it_returns_altered_field_values ()
351351 {
352- $ customForm = $ this ->formBuilder ->create ('CustomNesterDummyForm ' );
353-
354352 $ this ->request ['name ' ] = 'lower case ' ;
355353 $ this ->request ['subcustom ' ] = ['title ' => 'Bar foo ' , 'body ' => 'Foo bar ' ];
354+ $ this ->request ['subcustom_collection ' ] = [
355+ ['title ' => 'Item 1 title ' , 'body ' => 'Item 1 body ' ],
356+ ['title ' => 'Item 2 title ' , 'body ' => 'Item 2 body ' ],
357+ ];
358+
359+ $ customForm = $ this ->formBuilder ->create ('CustomNesterDummyForm ' );
356360
357361 $ this ->assertEquals (
358362 [
359363 'name ' => 'LOWER CASE ' ,
360364 'options ' => ['x ' ],
361- 'subcustom ' => ['title ' => 'Bar foo ' , 'body ' => 'Foo bar ' ],
365+ 'subcustom ' => ['title ' => 'Bar foo ' , 'body ' => 'FOO BAR ' ],
366+ 'subcustom_collection ' => [
367+ ['title ' => 'Item 1 title ' , 'body ' => 'ITEM 1 BODY ' ],
368+ ['title ' => 'Item 2 title ' , 'body ' => 'ITEM 2 BODY ' ],
369+ ],
362370 ],
363371 $ customForm ->getFieldValues ()
364372 );
You can’t perform that action at this time.
0 commit comments