@@ -173,39 +173,22 @@ on other extensions. You need to add those extensions to the factory object::
173
173
174
174
use AppBundle\Form\Type\TestedType;
175
175
use AppBundle\Model\TestObject;
176
- use Symfony\Component\Form\Test\TypeTestCase ;
176
+ use Symfony\Component\Form\Extension\Validator\ValidatorExtension ;
177
177
use Symfony\Component\Form\Forms;
178
178
use Symfony\Component\Form\FormBuilder;
179
- use Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension ;
179
+ use Symfony\Component\Form\Test\TypeTestCase ;
180
180
use Symfony\Component\Validator\ConstraintViolationList;
181
181
182
182
class TestedTypeTest extends TypeTestCase
183
183
{
184
- protected function setUp ()
184
+ protected function getExtensions ()
185
185
{
186
- parent::setUp();
187
-
188
- $validator = $this->getMock('\Symfony\Component\Validator\ValidatorInterface');
186
+ $validator = $this->getMock('\Symfony\Component\Validator\Validator\ValidatorInterface');
189
187
$validator->method('validate')->will($this->returnValue(new ConstraintViolationList()));
190
188
191
- $this->factory = Forms::createFormFactoryBuilder()
192
- ->addExtensions($this->getExtensions())
193
- ->addTypeExtension(
194
- new FormTypeValidatorExtension(
195
- $validator
196
- )
197
- )
198
- ->addTypeGuesser(
199
- $this->getMockBuilder(
200
- 'Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser'
201
- )
202
- ->disableOriginalConstructor()
203
- ->getMock()
204
- )
205
- ->getFormFactory();
206
-
207
- $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
208
- $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
189
+ return array(
190
+ new ValidatorExtension($validator),
191
+ );
209
192
}
210
193
211
194
// ... your tests
0 commit comments