[Validator] Skip tests that rely on Doctrine being present if its not

This commit is contained in:
Jordi Boggiano 2011-01-29 20:55:17 +01:00 committed by Fabien Potencier
parent e081e5919e
commit 571c984625

View File

@ -75,6 +75,9 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
public function testBuildDefaultFromAnnotations()
{
if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
$this->markTestSkipped('Doctrine is required for this test');
}
$factory = ValidatorFactory::buildDefault();
$context = new ValidatorContext();
@ -87,6 +90,9 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
public function testBuildDefaultFromAnnotationsWithCustomNamespaces()
{
if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
$this->markTestSkipped('Doctrine is required for this test');
}
$factory = ValidatorFactory::buildDefault(array(), true, array(
'myns' => 'My\\Namespace\\',
));
@ -142,6 +148,9 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
public function testBuildDefaultFromMultipleLoaders()
{
if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
$this->markTestSkipped('Doctrine is required for this test');
}
$xmlPath = __DIR__.'/Mapping/Loader/constraint-mapping.xml';
$yamlPath = __DIR__.'/Mapping/Loader/constraint-mapping.yml';
$factory = ValidatorFactory::buildDefault(array($xmlPath, $yamlPath), true, null, 'loadMetadata');