File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -117,21 +117,28 @@ might look like this::
117
117
118
118
To create your form correctly, you need to make the type available to the
119
119
form factory in your test. The easiest way is to register it manually
120
- before creating the parent form::
120
+ before creating the parent form using PreloadedExtension class ::
121
121
122
122
// src/Acme/TestBundle/Tests/Form/Type/TestedTypeTests.php
123
123
namespace Acme\TestBundle\Tests\Form\Type;
124
124
125
125
use Acme\TestBundle\Form\Type\TestedType;
126
126
use Acme\TestBundle\Model\TestObject;
127
- use Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase;
127
+ use Symfony\Component\Form\Test\TypeTestCase;
128
+ use Symfony\Component\Form\PreloadedExtension;
128
129
129
130
class TestedTypeTest extends TypeTestCase
130
131
{
131
- public function testBindValidData ()
132
+ protected function getExtensions ()
132
133
{
133
- $this->factory->addType(new TestChildType());
134
+ $childType = new TestChildType();
135
+ return array(new PreloadedExtension(array(
136
+ $childType->getName() => $childType
137
+ ), array()));
138
+ }
134
139
140
+ public function testBindValidData()
141
+ {
135
142
$type = new TestedType();
136
143
$form = $this->factory->create($type);
137
144
You can’t perform that action at this time.
0 commit comments