77d586412b76b7b1573d543c8ccd0f5c18dd4e26
[yaffs-website] / vendor / symfony / validator / Tests / ValidatorBuilderTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.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\Validator\Tests;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Validator\ValidatorBuilder;
16 use Symfony\Component\Validator\ValidatorBuilderInterface;
17
18 class ValidatorBuilderTest extends TestCase
19 {
20     /**
21      * @var ValidatorBuilderInterface
22      */
23     protected $builder;
24
25     protected function setUp()
26     {
27         $this->builder = new ValidatorBuilder();
28     }
29
30     protected function tearDown()
31     {
32         $this->builder = null;
33     }
34
35     public function testAddObjectInitializer()
36     {
37         $this->assertSame($this->builder, $this->builder->addObjectInitializer(
38             $this->getMockBuilder('Symfony\Component\Validator\ObjectInitializerInterface')->getMock()
39         ));
40     }
41
42     public function testAddObjectInitializers()
43     {
44         $this->assertSame($this->builder, $this->builder->addObjectInitializers(array()));
45     }
46
47     public function testAddXmlMapping()
48     {
49         $this->assertSame($this->builder, $this->builder->addXmlMapping('mapping'));
50     }
51
52     public function testAddXmlMappings()
53     {
54         $this->assertSame($this->builder, $this->builder->addXmlMappings(array()));
55     }
56
57     public function testAddYamlMapping()
58     {
59         $this->assertSame($this->builder, $this->builder->addYamlMapping('mapping'));
60     }
61
62     public function testAddYamlMappings()
63     {
64         $this->assertSame($this->builder, $this->builder->addYamlMappings(array()));
65     }
66
67     public function testAddMethodMapping()
68     {
69         $this->assertSame($this->builder, $this->builder->addMethodMapping('mapping'));
70     }
71
72     public function testAddMethodMappings()
73     {
74         $this->assertSame($this->builder, $this->builder->addMethodMappings(array()));
75     }
76
77     public function testEnableAnnotationMapping()
78     {
79         $this->assertSame($this->builder, $this->builder->enableAnnotationMapping());
80     }
81
82     public function testDisableAnnotationMapping()
83     {
84         $this->assertSame($this->builder, $this->builder->disableAnnotationMapping());
85     }
86
87     public function testSetMetadataCache()
88     {
89         $this->assertSame($this->builder, $this->builder->setMetadataCache(
90             $this->getMockBuilder('Symfony\Component\Validator\Mapping\Cache\CacheInterface')->getMock())
91         );
92     }
93
94     public function testSetConstraintValidatorFactory()
95     {
96         $this->assertSame($this->builder, $this->builder->setConstraintValidatorFactory(
97             $this->getMockBuilder('Symfony\Component\Validator\ConstraintValidatorFactoryInterface')->getMock())
98         );
99     }
100
101     public function testSetTranslator()
102     {
103         $this->assertSame($this->builder, $this->builder->setTranslator(
104             $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock())
105         );
106     }
107
108     public function testSetTranslationDomain()
109     {
110         $this->assertSame($this->builder, $this->builder->setTranslationDomain('TRANS_DOMAIN'));
111     }
112
113     public function testGetValidator()
114     {
115         $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator());
116     }
117 }