|
| 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