|
@@ -11,7 +11,7 @@
|
|
|
|
|
|
namespace Symfony\Tests\Component\Validator;
|
|
namespace Symfony\Tests\Component\Validator;
|
|
|
|
|
|
-use Doctrine\Common\Annotations\Reader;
|
|
|
|
|
|
+use Doctrine\Common\Annotations\AnnotationReader;
|
|
use Symfony\Component\Validator\Validator;
|
|
use Symfony\Component\Validator\Validator;
|
|
use Symfony\Component\Validator\ValidatorContext;
|
|
use Symfony\Component\Validator\ValidatorContext;
|
|
use Symfony\Component\Validator\ValidatorFactory;
|
|
use Symfony\Component\Validator\ValidatorFactory;
|
|
@@ -76,14 +76,14 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testBuildDefaultFromAnnotations()
|
|
public function testBuildDefaultFromAnnotations()
|
|
{
|
|
{
|
|
- if (!class_exists('Doctrine\Common\Annotations\Reader')) {
|
|
|
|
|
|
+ if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
|
|
$this->markTestSkipped('Annotations is required for this test');
|
|
$this->markTestSkipped('Annotations is required for this test');
|
|
}
|
|
}
|
|
$factory = ValidatorFactory::buildDefault();
|
|
$factory = ValidatorFactory::buildDefault();
|
|
|
|
|
|
$context = new ValidatorContext();
|
|
$context = new ValidatorContext();
|
|
$context
|
|
$context
|
|
- ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new Reader())))
|
|
|
|
|
|
+ ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())))
|
|
->setConstraintValidatorFactory(new ConstraintValidatorFactory());
|
|
->setConstraintValidatorFactory(new ConstraintValidatorFactory());
|
|
|
|
|
|
$this->assertEquals(new ValidatorFactory($context), $factory);
|
|
$this->assertEquals(new ValidatorFactory($context), $factory);
|
|
@@ -91,14 +91,14 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testBuildDefaultFromAnnotationsWithCustomNamespaces()
|
|
public function testBuildDefaultFromAnnotationsWithCustomNamespaces()
|
|
{
|
|
{
|
|
- if (!class_exists('Doctrine\Common\Annotations\Reader')) {
|
|
|
|
|
|
+ if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
|
|
$this->markTestSkipped('Annotations is required for this test');
|
|
$this->markTestSkipped('Annotations is required for this test');
|
|
}
|
|
}
|
|
$factory = ValidatorFactory::buildDefault(array(), true);
|
|
$factory = ValidatorFactory::buildDefault(array(), true);
|
|
|
|
|
|
$context = new ValidatorContext();
|
|
$context = new ValidatorContext();
|
|
$context
|
|
$context
|
|
- ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new Reader())))
|
|
|
|
|
|
+ ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())))
|
|
->setConstraintValidatorFactory(new ConstraintValidatorFactory());
|
|
->setConstraintValidatorFactory(new ConstraintValidatorFactory());
|
|
|
|
|
|
$this->assertEquals(new ValidatorFactory($context), $factory);
|
|
$this->assertEquals(new ValidatorFactory($context), $factory);
|
|
@@ -145,7 +145,7 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testBuildDefaultFromMultipleLoaders()
|
|
public function testBuildDefaultFromMultipleLoaders()
|
|
{
|
|
{
|
|
- if (!class_exists('Doctrine\Common\Annotations\Reader')) {
|
|
|
|
|
|
+ if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
|
|
$this->markTestSkipped('Annotations is required for this test');
|
|
$this->markTestSkipped('Annotations is required for this test');
|
|
}
|
|
}
|
|
$xmlPath = __DIR__.'/Mapping/Loader/constraint-mapping.xml';
|
|
$xmlPath = __DIR__.'/Mapping/Loader/constraint-mapping.xml';
|
|
@@ -155,7 +155,7 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
|
|
$chain = new LoaderChain(array(
|
|
$chain = new LoaderChain(array(
|
|
new XmlFilesLoader(array($xmlPath)),
|
|
new XmlFilesLoader(array($xmlPath)),
|
|
new YamlFilesLoader(array($yamlPath)),
|
|
new YamlFilesLoader(array($yamlPath)),
|
|
- new AnnotationLoader(new Reader()),
|
|
|
|
|
|
+ new AnnotationLoader(new AnnotationReader()),
|
|
new StaticMethodLoader('loadMetadata'),
|
|
new StaticMethodLoader('loadMetadata'),
|
|
));
|
|
));
|
|
|
|
|