expectError("Annotation 'ClassRestrictedAnnotation' not allowed on BadlyAnnotatedClass::method"); $reflection = new ReflectionAnnotatedClass('BadlyAnnotatedClass'); $method = $reflection->getMethod('method'); } public function testClassAnnotationThrowsErrorWhenOnProperty() { $this->expectError("Annotation 'ClassRestrictedAnnotation' not allowed on BadlyAnnotatedClass::\$property"); $reflection = new ReflectionAnnotatedClass('BadlyAnnotatedClass'); $method = $reflection->getProperty('property'); } public function testSingleTargetAnnotationThrowsNoErrorWhenOnRightPlace() { $reflection = new ReflectionAnnotatedClass('SuccesfullyAnnotatedClass'); $method = $reflection->getMethod('method'); $property = $reflection->getProperty('property'); $this->assertNoErrors(); } public function testMultiTargetAnnotationThrowsErrorWhenOnWrongPlace() { $this->expectError("Annotation 'ClassOrPropertyRestrictedAnnotation' not allowed on BadlyAnnotatedClass::method2"); $reflection = new ReflectionAnnotatedClass('BadlyAnnotatedClass'); $method = $reflection->getMethod('method2'); } public function testMultiTargetAnnotationThrowsNoErrorWhenOnRightPlace() { $reflection = new ReflectionAnnotatedClass('SuccesfullyAnnotatedClass'); $method = $reflection->getProperty('property2'); $this->assertNoErrors(); } } ?>