]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php
twig implementation
[github/wallabag/wallabag.git] / vendor / symfony / form / Symfony / Component / Form / Tests / Extension / Validator / Type / TypeTestCase.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
13
14 use Symfony\Component\Form\Test\TypeTestCase as BaseTypeTestCase;
15 use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
16
17 abstract class TypeTestCase extends BaseTypeTestCase
18 {
19 protected $validator;
20
21 protected function setUp()
22 {
23 if (!class_exists('Symfony\Component\Validator\Constraint')) {
24 $this->markTestSkipped('The "Validator" component is not available');
25 }
26
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));
32
33 parent::setUp();
34 }
35
36 protected function tearDown()
37 {
38 $this->validator = null;
39
40 parent::tearDown();
41 }
42
43 protected function getExtensions()
44 {
45 return array_merge(parent::getExtensions(), array(
46 new ValidatorExtension($this->validator),
47 ));
48 }
49 }