@@ -36,8 +36,8 @@ The Basics
3636
3737The simplest ``TypeTestCase `` implementation looks like the following::
3838
39- // src /AppBundle/Tests /Form/Type/TestedTypeTest.php
40- namespace AppBundle\ Tests\Form\Type;
39+ // tests /AppBundle/Form/Type/TestedTypeTest.php
40+ namespace Tests\AppBundle \Form\Type;
4141
4242 use AppBundle\Form\Type\TestedType;
4343 use AppBundle\Model\TestObject;
@@ -117,15 +117,18 @@ might look like this::
117117
118118 // src/AppBundle/Form/Type/TestedType.php
119119
120- // ... the buildForm method
121- $builder->add('app_test_child_type');
120+ // ...
121+ public function buildForm(FormBuilderInterface $builder, array $options)
122+ {
123+ $builder->add('app_test_child_type');
124+ }
122125
123126To create your form correctly, you need to make the type available to the
124127form factory in your test. The easiest way is to register it manually
125128before creating the parent form using the ``PreloadedExtension `` class::
126129
127- // src /AppBundle/Tests /Form/Type/TestedTypeTests.php
128- namespace AppBundle\ Tests\Form\Type;
130+ // tests /AppBundle/Form/Type/TestedTypeTests.php
131+ namespace Tests\AppBundle \Form\Type;
129132
130133 use AppBundle\Form\Type\TestedType;
131134 use AppBundle\Model\TestObject;
@@ -158,7 +161,7 @@ before creating the parent form using the ``PreloadedExtension`` class::
158161 be getting errors that are not related to the form you are currently
159162 testing but to its children.
160163
161- Adding custom Extensions
164+ Adding Custom Extensions
162165------------------------
163166
164167It often happens that you use some options that are added by
@@ -168,8 +171,8 @@ The ``TypeTestCase`` loads only the core form extension so an "Invalid option"
168171exception will be raised if you try to use it for testing a class that depends
169172on other extensions. You need to add those extensions to the factory object::
170173
171- // src /AppBundle/Tests /Form/Type/TestedTypeTests.php
172
8000
- namespace AppBundle\ Tests\Form\Type;
174+ // tests /AppBundle/Form/Type/TestedTypeTests.php
175+ namespace Tests\AppBundle \Form\Type;
173176
174177 use AppBundle\Form\Type\TestedType;
175178 use AppBundle\Model\TestObject;
@@ -217,16 +220,15 @@ Testing against different Sets of Data
217220If you are not familiar yet with PHPUnit's `data providers `_, this might be
218221a good opportunity to use them::
219222
220- // src /AppBundle/Tests /Form/Type/TestedTypeTests.php
221- namespace AppBundle\ Tests\Form\Type;
223+ // tests /AppBundle/Form/Type/TestedTypeTests.php
224+ namespace Tests\AppBundle \Form\Type;
222225
223226 use AppBundle\Form\Type\TestedType;
224227 use AppBundle\Model\TestObject;
225228 use Symfony\Component\Form\Test\TypeTestCase;
226229
227230 class TestedTypeTest extends TypeTestCase
228231 {
229-
230232 /**
231233 * @dataProvider getValidTestData
232234 */
0 commit comments