File tree Expand file tree Collapse file tree 3 files changed +21
-10
lines changed
Expand file tree Collapse file tree 3 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ Learn more about it in its [documentation](https://github.com/darkwebdesign/symf
1515
1616## Features
1717
18- * ArrayType, handles unstructured array data.
1918* BirthdayType, handles birthday data.
2019* BooleanType, transforms an user selected value into a boolean.
2120* EntityType, transforms an user entered identifier into a Doctrine entity.
21+ * UnstructuredType, handles unstructured data.
2222
2323## Installing via Composer
2424
Original file line number Diff line number Diff line change 2424use Symfony \Component \OptionsResolver \OptionsResolver ;
2525
2626/**
27- * Array form field type.
27+ * Unstructured form field type.
2828 *
2929 * @author Raymond Schouten
3030 *
3131 * @since 3.4
3232 */
33- class ArrayType extends AbstractType
33+ class UnstructuredType extends AbstractType
3434{
3535 /**
3636 * Configures the options for this type.
Original file line number Diff line number Diff line change 2020
2121namespace DarkWebDesign \SymfonyAddonFormTypes \Tests ;
2222
23- use DarkWebDesign \SymfonyAddonFormTypes \ArrayType ;
23+ use DarkWebDesign \SymfonyAddonFormTypes \UnstructuredType ;
2424use Symfony \Component \Form \Test \TypeTestCase ;
2525
26- class ArrayTypeTest extends TypeTestCase
26+ class UnstructuredTypeTest extends TypeTestCase
2727{
28- public function test ()
28+ public function testArray ()
2929 {
30- $ data = [
30+ $ value = [
3131 'age ' => 30 ,
3232 'name ' => [
3333 'first ' => 'Lawson ' ,
3434 'last ' => 'Phelps ' ,
3535 ],
3636 ];
3737
38- $ form = $ this ->factory ->create (ArrayType ::class);
39- $ form ->submit ($ data );
38+ $ form = $ this ->factory ->create (UnstructuredType ::class);
39+ $ form ->submit ($ value );
4040
4141 $ this ->assertTrue ($ form ->isSynchronized ());
42- $ this ->assertSame ($ data , $ form ->getData ());
42+ $ this ->assertSame ($ value , $ form ->getData ());
43+ }
44+
45+ public function testString ()
46+ {
47+ $ value = 'Monday ' ;
48+
49+ $ form = $ this ->factory ->create (UnstructuredType::class);
50+ $ form ->submit ($ value );
51+
52+ $ this ->assertTrue ($ form ->isSynchronized ());
53+ $ this ->assertSame ($ value , $ form ->getData ());
4354 }
4455}
You can’t perform that action at this time.
0 commit comments