@@ -173,39 +173,22 @@ on other extensions. You need to add those extensions to the factory object::
173173
174174 use AppBundle\Form\Type\TestedType;
175175 use AppBundle\Model\TestObject;
176- use Symfony\Component\Form\Test\TypeTestCase ;
176+ use Symfony\Component\Form\Extension\Validator\ValidatorExtension ;
177177 use Symfony\Component\Form\Forms;
178178 use Symfony\Component\Form\FormBuilder;
179- use Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension ;
179+ use Symfony\Component\Form\Test\TypeTestCase ;
180180 use Symfony\Component\Validator\ConstraintViolationList;
181181
182182 class TestedTypeTest extends TypeTestCase
183183 {
184- protected function setUp ()
184+ protected function getExtensions ()
185185 {
186- parent::setUp();
187-
188- $validator = $this->getMock('\Symfony\Component\Validator\ValidatorInterface');
186+ $validator = $this->getMock('\Symfony\Component\Validator\Validator\ValidatorInterface');
189187 $validator->method('validate')->will($this->returnValue(new ConstraintViolationList()));
190188
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+ );
209192 }
210193
211194 // ... your tests
0 commit comments