a38f1abb9bbc747f88049bd8a79dac25d87e952b
[yaffs-website] / vendor / symfony / validator / Tests / LegacyValidatorTest.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 Symfony\Component\Translation\IdentityTranslator;
15 use Symfony\Component\Validator\Constraints\Valid;
16 use Symfony\Component\Validator\ConstraintValidatorFactory;
17 use Symfony\Component\Validator\MetadataFactoryInterface;
18 use Symfony\Component\Validator\Tests\Fixtures\Entity;
19 use Symfony\Component\Validator\Tests\Validator\AbstractLegacyApiTest;
20 use Symfony\Component\Validator\Validator as LegacyValidator;
21
22 /**
23  * @group legacy
24  */
25 class LegacyValidatorTest extends AbstractLegacyApiTest
26 {
27     protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array())
28     {
29         $translator = new IdentityTranslator();
30         $translator->setLocale('en');
31
32         return new LegacyValidator($metadataFactory, new ConstraintValidatorFactory(), $translator, 'validators', $objectInitializers);
33     }
34
35     /**
36      * @expectedException \Symfony\Component\Validator\Exception\ValidatorException
37      */
38     public function testValidateValueRejectsValid()
39     {
40         $this->validator->validateValue(new Entity(), new Valid());
41     }
42 }