/** * @covers phpDocumentor\Descriptor\DescriptorAbstract::setNamespace * @covers phpDocumentor\Descriptor\DescriptorAbstract::getNamespace */ public function testSettingAndGettingNamespace() { $this->assertNull($this->fixture->getNamespace()); $mock = m::mock('phpDocumentor\\Descriptor\\NamespaceDescriptor'); $this->fixture->setNamespace($mock); $this->assertSame($mock, $this->fixture->getNamespace()); }
/** * Overrides the name and namespace of an element with a separated version of the class name. * * If a class is separated by underscores than the last part is set as name and the first parts are set as * namespace with the namespace separator instead of an underscore. * * @param DescriptorAbstract $value * * @return DescriptorAbstract|null */ public function filter($value) { if ($value) { $namespace = $value->getNamespace() == '' ? '\\' . $this->namespacePrefix : $value->getNamespace(); $value->setNamespace($this->namespaceFromLegacyNamespace($namespace, $value->getName())); $value->setName($this->classNameFromLegacyNamespace($value->getName())); } return $value; }