public function testRetrieveDataFromAnnotation() { $resultArr = array(); $class = new \ReflectionClass($model = new AnnotatedModel()); $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC); $properties = $class->getproperties(); foreach ($methods as $method) { $annotations = $this->reader->getMethodAnnotations($method); foreach ($annotations as $annotation) { switch (true) { case $annotation instanceof IdentityAnnotation: if (!empty($annotation->name) && $annotation->type == 'getter') { $resultArr[$annotation->name] = $method->invoke($model); } break; } } } foreach ($properties as $property) { $annotations = $this->reader->getPropertyAnnotations($property); foreach ($annotations as $annotation) { switch (true) { case $annotation instanceof IdentityAnnotation: if (empty($annotation->name)) { $annotation->name = $property->getName(); } $resultArr[$annotation->name] = $this->accessor->getValue($model, $property->getName()); break; } } } $this->assert->array($resultArr)->hasSize(3)->hasKeys(array("implicitName", "explicitName", "virtualName"))->isIdenticalTo(array("virtualName" => "virtualValue", "implicitName" => "implicitValue", "explicitName" => "explicitValue")); }