4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Tests;
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;
25 class LegacyValidatorTest extends AbstractLegacyApiTest
27 protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array())
29 $translator = new IdentityTranslator();
30 $translator->setLocale('en');
32 return new LegacyValidator($metadataFactory, new ConstraintValidatorFactory(), $translator, 'validators', $objectInitializers);
36 * @expectedException \Symfony\Component\Validator\Exception\ValidatorException
38 public function testValidateValueRejectsValid()
40 $this->validator->validateValue(new Entity(), new Valid());