4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Form\Tests\Extension\Validator\Type
;
14 use Symfony\Component\Form\Test\TypeTestCase
as BaseTypeTestCase
;
15 use Symfony\Component\Form\Extension\Validator\ValidatorExtension
;
17 abstract class TypeTestCase
extends BaseTypeTestCase
21 protected function setUp()
23 if (!class_exists('Symfony\Component\Validator\Constraint')) {
24 $this->markTestSkipped('The "Validator" component is not available');
27 $this->validator
= $this->getMock('Symfony\Component\Validator\ValidatorInterface');
28 $metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
29 $this->validator
->expects($this->once())->method('getMetadataFactory')->will($this->returnValue($metadataFactory));
30 $metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
31 $metadataFactory->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata));
36 protected function tearDown()
38 $this->validator
= null;
43 protected function getExtensions()
45 return array_merge(parent
::getExtensions(), array(
46 new ValidatorExtension($this->validator
),