/** * @param string $name The name of the current constant. * * @return ConstantDescriptor */ protected function whenFixtureHasConstantInParentClassWithSameName($name) { $result = new ConstantDescriptor(); $result->setName($name); $parent = new ClassDescriptor(); $parent->getConstants()->set($name, $result); $class = new ClassDescriptor(); $class->setParent($parent); $this->fixture->setParent($class); return $result; }
/** * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes * @covers phpDocumentor\Descriptor\ConstantDescriptor::getVar */ public function testGetTypesUsingInheritanceOfVarTag() { $expected = array('string', 'null'); $constantName = 'CONSTANT'; $this->fixture->setName($constantName); $parentClass = $this->createParentClassWithSuperClassAndConstant($expected, $constantName); // Attempt to get the types; which come from the superclass' constants $this->fixture->setParent($parentClass); $types = $this->fixture->getTypes(); $this->assertSame($expected, $types); }