public function testReflectionAnnotatedClass() { $reflection = new ReflectionAnnotatedClass('Example'); $this->assertTrue($reflection->hasAnnotation('FirstAnnotation')); $this->assertTrue($reflection->hasAnnotation('SecondAnnotation')); $this->assertFalse($reflection->hasAnnotation('NonExistentAnnotation')); $this->assertIsA($reflection->getAnnotation('FirstAnnotation'), 'FirstAnnotation'); $this->assertIsA($reflection->getAnnotation('SecondAnnotation'), 'SecondAnnotation'); $annotations = $reflection->getAnnotations(); $this->assertEqual(count($annotations), 2); $this->assertIsA($annotations[0], 'FirstAnnotation'); $this->assertIsA($annotations[1], 'SecondAnnotation'); $this->assertFalse($reflection->getAnnotation('NonExistentAnnotation')); $this->assertIsA($reflection->getConstructor(), 'ReflectionAnnotatedMethod'); $this->assertIsA($reflection->getMethod('exampleMethod'), 'ReflectionAnnotatedMethod'); foreach ($reflection->getMethods() as $method) { $this->assertIsA($method, 'ReflectionAnnotatedMethod'); } $this->assertIsA($reflection->getProperty('exampleProperty'), 'ReflectionAnnotatedProperty'); foreach ($reflection->getProperties() as $property) { $this->assertIsA($property, 'ReflectionAnnotatedProperty'); } foreach ($reflection->getInterfaces() as $interface) { $this->assertIsA($interface, 'ReflectionAnnotatedClass'); } $this->assertIsA($reflection->getParentClass(), 'ReflectionAnnotatedClass'); }