/** * Tests whether the referrer string is correctly retrieved. * * @covers phpDocumentor\Plugin\Core\Transformer\Behaviour\Inherit\Node\ConstantNode::getReferrerString * * @return void */ public function testGetReferrerString() { $dom = new \DOMDocument(); $node = new \DOMElement('constant'); $dom->appendChild($node); $node->appendChild(new \DOMElement('name', 'CONST')); $parent = $this->getMock('phpDocumentor\\Plugin\\Core\\Transformer\\Behaviour\\Inherit\\Node' . '\\ClassNode', array('getFQCN'), array(), '', false); $array = array(); $parent->expects($this->once())->method('getFQCN')->will($this->returnValue('MyParent')); $fixture = new ConstantNode($node, $array, $parent); $this->assertEquals('MyParent::CONST', $fixture->getReferrerString()); $this->assertEquals('MyNewParent::CONST', $fixture->getReferrerString('MyNewParent')); }
/** * Returns all class constants. * * @return ConstantNode[] */ public function getConstants() { $result = array(); $nodes = $this->getDirectElementsByTagName($this->node, 'constant'); foreach ($nodes as $node) { $node = new ConstantNode($node, $this->nodes, $this); $result[$node->getName()] = $node; } return $result; }