ソースを参照

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

Jordi Boggiano 14 年 前
コミット
571c984625

+ 9 - 0
tests/Symfony/Tests/Component/Validator/ValidatorFactoryTest.php

@@ -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');