Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / common / tests / Doctrine / Tests / Common / Annotations / SimpleAnnotationReaderTest.php
1 <?php
2
3 namespace Doctrine\Tests\Common\Annotations;
4
5 use Doctrine\Common\Annotations\SimpleAnnotationReader;
6
7 class SimpleAnnotationReaderTest extends AbstractReaderTest
8 {
9     /**
10      * Contrary to the behavior of the default annotation reader, we do just ignore
11      * these in the simple annotation reader (so, no expected exception here).
12      */
13     public function testImportDetectsNotImportedAnnotation()
14     {
15         parent::testImportDetectsNotImportedAnnotation();
16     }
17
18     /**
19      * Contrary to the behavior of the default annotation reader, we do just ignore
20      * these in the simple annotation reader (so, no expected exception here).
21      */
22     public function testImportDetectsNonExistentAnnotation()
23     {
24         parent::testImportDetectsNonExistentAnnotation();
25     }
26
27     /**
28      * Contrary to the behavior of the default annotation reader, we do just ignore
29      * these in the simple annotation reader (so, no expected exception here).
30      */
31     public function testClassWithInvalidAnnotationTargetAtClassDocBlock()
32     {
33         parent::testClassWithInvalidAnnotationTargetAtClassDocBlock();
34     }
35
36     /**
37      * Contrary to the behavior of the default annotation reader, we do just ignore
38      * these in the simple annotation reader (so, no expected exception here).
39      */
40     public function testClassWithInvalidAnnotationTargetAtPropertyDocBlock()
41     {
42         parent::testClassWithInvalidAnnotationTargetAtPropertyDocBlock();
43     }
44
45     /**
46      * Contrary to the behavior of the default annotation reader, we do just ignore
47      * these in the simple annotation reader (so, no expected exception here).
48      */
49     public function testClassWithInvalidNestedAnnotationTargetAtPropertyDocBlock()
50     {
51         parent::testClassWithInvalidNestedAnnotationTargetAtPropertyDocBlock();
52     }
53
54     /**
55      * Contrary to the behavior of the default annotation reader, we do just ignore
56      * these in the simple annotation reader (so, no expected exception here).
57      */
58     public function testClassWithInvalidAnnotationTargetAtMethodDocBlock()
59     {
60         parent::testClassWithInvalidAnnotationTargetAtMethodDocBlock();
61     }
62
63     /**
64      * @expectedException Doctrine\Common\Annotations\AnnotationException
65      */
66     public function testInvalidAnnotationUsageButIgnoredClass()
67     {
68         parent::testInvalidAnnotationUsageButIgnoredClass();
69     }
70
71     /**
72      * @group DDC-1660
73      * @group regression
74      *
75      * Contrary to the behavior of the default annotation reader, @version is not ignored
76      */
77     public function testInvalidAnnotationButIgnored()
78     {
79         $reader = $this->getReader();
80         $class  = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassDDC1660');
81
82         $this->assertTrue(class_exists('Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Version'));
83         $this->assertCount(1, $reader->getClassAnnotations($class));
84         $this->assertCount(1, $reader->getMethodAnnotations($class->getMethod('bar')));
85         $this->assertCount(1, $reader->getPropertyAnnotations($class->getProperty('foo')));
86     }
87     
88     protected function getReader()
89     {
90         $reader = new SimpleAnnotationReader();
91         $reader->addNamespace(__NAMESPACE__);
92         $reader->addNamespace(__NAMESPACE__ . '\Fixtures');
93         $reader->addNamespace(__NAMESPACE__ . '\Fixtures\Annotation');
94
95         return $reader;
96     }
97 }