LegacyValidator2Dot5ApiTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Tests\Validator;
  11. use Symfony\Component\Translation\IdentityTranslator;
  12. use Symfony\Component\Validator\ConstraintValidatorFactory;
  13. use Symfony\Component\Validator\Context\LegacyExecutionContextFactory;
  14. use Symfony\Component\Validator\MetadataFactoryInterface;
  15. use Symfony\Component\Validator\Validator\LegacyValidator;
  16. /**
  17. * @group legacy
  18. */
  19. class LegacyValidator2Dot5ApiTest extends Abstract2Dot5ApiTest
  20. {
  21. protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array())
  22. {
  23. $translator = new IdentityTranslator();
  24. $translator->setLocale('en');
  25. $contextFactory = new LegacyExecutionContextFactory($metadataFactory, $translator);
  26. $validatorFactory = new ConstraintValidatorFactory();
  27. return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers);
  28. }
  29. }