Permalink
Browse files

Merge pull request #178 from lemonde/master

Ignored annotations not used in the pre-parser with AnnotationReader
  • Loading branch information...
2 parents 0fd5533 + d43e463 commit 44ec7118f8a403ece299763709d1d0c7ecd4c84f @schmittjoh schmittjoh committed Sep 18, 2012
@@ -395,6 +395,7 @@ private function collectAnnotationMetadata($name)
self::$metadataParser = new self();
self::$metadataParser->setTarget(Target::TARGET_CLASS);
self::$metadataParser->setIgnoreNotImportedAnnotations(true);
+ self::$metadataParser->setIgnoredAnnotationNames($this->ignoredAnnotationNames);
self::$metadataParser->setImports(array(
'target' => 'Doctrine\Common\Annotations\Annotation\Target',
'attribute' => 'Doctrine\Common\Annotations\Annotation\Attribute',
@@ -114,6 +114,13 @@ public function testClassWithInvalidAnnotationTargetAtClassDocBlock()
$reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtClass'));
}
+ public function testClassWithWithInclude()
+ {
+ $reader = $this->getReader();
+ $annots = $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithRequire'));
+ $this->assertCount(1, $annots);
+ }
+
/**
* @expectedException Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$foo. You may only use this annotation on these code elements: CLASS
@@ -438,6 +445,15 @@ class DummyGeneratedValue extends \Doctrine\Common\Annotations\Annotation {}
class DummyAnnotation extends \Doctrine\Common\Annotations\Annotation {
public $dummyValue;
}
+
+/**
+ * @api
+ * @Annotation
+ */
+class DummyAnnotationWithIgnoredAnnotation extends \Doctrine\Common\Annotations\Annotation {
+ public $dummyValue;
+}
+
/** @Annotation */
class DummyJoinColumn extends \Doctrine\Common\Annotations\Annotation {
public $name;
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * This class is not an annotation
+ * It's a class build to test ClassWithInclude
+ */
+class Api
+{
+
+}
@@ -0,0 +1,15 @@
+<?php
+
+namespace Doctrine\Tests\Common\Annotations\Fixtures;
+
+// Include a class named Api
+require_once(__DIR__ . '/Api.php');
+
+use Doctrine\Tests\Common\Annotations\DummyAnnotationWithIgnoredAnnotation;
+
+/**
+ * @DummyAnnotationWithIgnoredAnnotation(dummyValue="hello")
+ */
+class ClassWithRequire
+{
+}

0 comments on commit 44ec711

Please sign in to comment.