/** * @covers phpDocumentor\Descriptor\ConstantDescriptor::getParent * @covers phpDocumentor\Descriptor\ConstantDescriptor::setParent */ public function testSetAndGetParentInterface() { $this->assertSame(null, $this->fixture->getParent()); $parentMock = m::mock('phpDocumentor\\Descriptor\\InterfaceDescriptor'); $parentMock->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('TestInterface'); $this->fixture->setParent($parentMock); $this->assertSame($parentMock, $this->fixture->getParent()); }
/** * Generates a URL from the given node or returns false if unable. * * @param \phpDocumentor\Descriptor\ConstantDescriptor $node * * @return string|false */ public function __invoke($node) { $name = $node->getName(); // global constant if ($node->getParent() instanceof \phpDocumentor\Descriptor\FileDescriptor || !$node->getParent()) { $namespaceName = $node->getNamespace(); return '/namespaces/' . str_replace('\\', '.', ltrim($namespaceName, '\\')) . '.html#constant_' . $name; } // class constant $className = $node->getParent()->getFullyQualifiedStructuralElementName(); return '/classes/' . str_replace('\\', '.', ltrim($className, '\\')) . '.html#constant_' . $name; }
/** * Returns the first part of the URL path that is specific to class constants. * * @param Descriptor\ConstantDescriptor $node * * @return string */ private function getUrlPathPrefixForClassConstants($node) { return '/classes/' . $this->converter->fromClass($node->getParent()->getFullyQualifiedStructuralElementName()); }