/** * @covers \Weasel\JsonMarshaller\Config\Annotations\JsonSubTypes\Type */ public function testParseMethodAnnotations() { $rClass = new \ReflectionClass('\\Weasel\\JsonMarshaller\\Config\\Annotations\\JsonSubTypes\\Type'); $annotationReader = new \Weasel\Annotation\AnnotationReader($rClass, new \Weasel\Annotation\AnnotationConfigurator()); $found = array(); foreach ($rClass->getMethods() as $method) { /** * @var \ReflectionMethod $method */ $name = $method->getName(); if (substr($name, 0, 2) === '__' && !($method->isStatic() || $method->isConstructor())) { continue; } $found[$name] = $annotationReader->getMethodAnnotations($name); } $expected = array("__construct" => array('\\Weasel\\Annotation\\Config\\Annotations\\AnnotationCreator' => array(new \Weasel\Annotation\Config\Annotations\AnnotationCreator(array(new \Weasel\Annotation\Config\Annotations\Parameter("value", 'string', true), new \Weasel\Annotation\Config\Annotations\Parameter("name", 'string', false))))), "getValue" => array(), "getName" => array()); $this->assertEquals($expected, $found); }
/** * @covers \Weasel\JsonMarshaller\Config\Annotations\JsonTypeInfo */ public function testParseMethodAnnotations() { $rClass = new \ReflectionClass('\\Weasel\\JsonMarshaller\\Config\\Annotations\\JsonTypeInfo'); $annotationReader = new \Weasel\Annotation\AnnotationReader($rClass, new \Weasel\Annotation\AnnotationConfigurator()); $found = array(); foreach ($rClass->getMethods() as $method) { /** * @var \ReflectionMethod $method */ $name = $method->getName(); if (substr($name, 0, 2) === '__' && !($method->isStatic() || $method->isConstructor())) { continue; } $found[$name] = $annotationReader->getMethodAnnotations($name); } $expected = array("__construct" => array('\\Weasel\\Annotation\\Config\\Annotations\\AnnotationCreator' => array(new \Weasel\Annotation\Config\Annotations\AnnotationCreator(array(new \Weasel\Annotation\Config\Annotations\Parameter("use", 'integer', true), new \Weasel\Annotation\Config\Annotations\Parameter("include", 'integer', false), new \Weasel\Annotation\Config\Annotations\Parameter("property", 'string', false), new \Weasel\Annotation\Config\Annotations\Parameter("visible", 'bool', false), new \Weasel\Annotation\Config\Annotations\Parameter("defaultImpl", 'string', false))))), "getUse" => array(), "getInclude" => array(), "getProperty" => array(), "getVisible" => array(), "getDefaultImpl" => array()); $this->assertEquals($expected, $found); }