8000 added tests for ValidatorBuilder fluent interface · samswitz/symfony@1ff081d · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ff081d

Browse files
author
Andreas Hucks
committed
added tests for ValidatorBuilder fluent interface
1 parent fec11ae commit 1ff081d

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6< 8000 span class="diff-text-marker">+
* (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 Symfony\Component\Validator\ValidatorBuilder;
15+
use Symfony\Component\Validator\ValidatorBuilderInterface;
16+
17+
class ValidatorBuilderTest extends \PHPUnit_Framework_TestCase
18+
{
19+
/**
20+
* @var ValidatorBuilderInterface
21+
*/
22+
protected $builder;
23+
24+
protected function setUp()
25+
{
26+
$this->builder = new ValidatorBuilder();
27+
}
28+
29+
protected function tearDown()
30+
{
31+
$this->builder = null;
32+
}
33+
34+
public function testAddObjectInitializer()
35+
{
36+
$this->assertSame($this->builder, $this->builder->addObjectInitializer(
37+
$this->getMock('Symfony\Component\Validator\ObjectInitializerInterface')
38+
));
39+
}
40+
41+
public function testAddObjectInitializers()
42+
{
43+
$this->assertSame($this->builder, $this->builder->addObjectInitializers(array()));
44+
}
45+
46+
public function testAddXmlMapping()
47+
{
48+
$this->assertSame($this->builder, $this->builder->addXmlMapping('mapping'));
49+
}
50+
51+
public function testAddXmlMappings()
52+
{
53+
$this->assertSame($this->builder, $this->builder->addXmlMappings(array()));
54+
}
55+
56+
public function testAddYamlMapping()
57+
{
58+
$this->assertSame($this->builder, $this->builder->addYamlMapping('mapping'));
59+
}
60+
61+
public function testAddYamlMappings()
62+
{
63+
$this->assertSame($this->builder, $this->builder->addYamlMappings(array()));
64+
}
65+
66+
public function testAddMethodMapping()
67+
{
68+
$this->assertSame($this->builder, $this->builder->addMethodMapping('mapping'));
69+
}
70+
71+
public function testAddMethodMappings()
72+
{
73+
$this->assertSame($this->builder, $this->builder->addMethodMappings(array()));
74+
}
75+
76+
public function testEnableAnnotationMapping()
77+
{
78+
if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
79+
$this->markTestSkipped('Annotations is required for this test');
80+
}
81+
82+
$this->assertSame($this->builder, $this->builder->enableAnnotationMapping());
83+
}
84+
85+
public function testDisableAnnotationMapping()
86+
{
87+
$this->assertSame($this->builder, $this->builder->disableAnnotationMapping());
88+
}
89+
90+
public function testSetMetadataFactory()
91+
{
92+
$this->assertSame($this->builder, $this->builder->setMetadataFactory(
93+
$this->getMock('Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface'))
94+
);
95+
}
96+
97+
public function testSetMetadataCache()
98+
{
99+
$this->assertSame($this->builder, $this->builder->setMetadataCache($this->getMock(
100+
'Symfony\Component\Validator\Mapping\Cache\CacheInterface'))
101+
);
102+
}
103+
104+
public function testSetConstraintValidatorFactory()
105+
{
106+
$this->assertSame($this->builder, $this->builder->setConstraintValidatorFactory(
107+
$this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface'))
108+
);
109+
}
110+
}

0 commit comments

Comments
 (0)
0