Просмотр исходного кода

Fix tests to run with Doctrine Common AnnotationRegistry

Benjamin Eberlei 14 лет назад
Родитель
Сommit
9069d06732

+ 7 - 0
autoload.php.dist

@@ -3,6 +3,7 @@
 require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
 
 use Symfony\Component\ClassLoader\UniversalClassLoader;
+use Doctrine\Common\Annotations\AnnotationRegistry;
 
 $loader = new UniversalClassLoader();
 $loader->registerNamespaces(array(
@@ -21,6 +22,12 @@ $loader->registerPrefixFallbacks(array(
 ));
 $loader->register();
 
+AnnotationRegistry::registerLoader(function($class) use ($loader) {
+    $loader->loadClass($class);
+    return class_exists($class, false);
+});
+AnnotationRegistry::registerFile(__DIR__.'/vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
+
 if (is_file(__DIR__.'/vendor/swiftmailer/lib/classes/Swift.php')) {
     require_once __DIR__.'/vendor/swiftmailer/lib/classes/Swift.php';
     Swift::registerAutoload(__DIR__.'/vendor/swiftmailer/lib/swift_init.php');

+ 0 - 1
tests/Symfony/Tests/Component/Validator/Mapping/Loader/AnnotationLoaderTest.php

@@ -36,7 +36,6 @@ class AnnotationLoaderTest extends \PHPUnit_Framework_TestCase
     public function testLoadClassMetadataReturnsTrueIfSuccessful()
     {
         $reader = new AnnotationReader();
-        $reader->setAutoloadAnnotations(true);
         $loader = new AnnotationLoader($reader);
         $metadata = new ClassMetadata('Symfony\Tests\Component\Validator\Fixtures\Entity');