/** * @covers phpDocumentor\Plugin\LegacyNamespaceConverter\LegacyNamespaceFilter::filter */ public function testPrefixedNamespaceWithNamespacedClassWillNotBeModified() { $this->filter->setNamespacePrefix('Vendor'); $descriptor = $this->createDescriptorMock(); $descriptor->shouldReceive('getName')->andReturn('ClassName'); $descriptor->shouldReceive('getNamespace')->andReturn('\\'); $descriptor->shouldReceive('setName')->with('ClassName')->once(); $descriptor->shouldReceive('setNamespace')->with('\\')->once(); $this->filter->filter($descriptor); $this->assertTrue(true); }
/** * Attaches the filter responsible for the conversion to all structural elements. * * @param ProjectDescriptorBuilder $builder * @param Filter $filterManager * * @return void */ private function addNamespaceFilter(ProjectDescriptorBuilder $builder, Filter $filterManager) { $filter = new LegacyNamespaceFilter($builder); // parse parameters foreach ($this->plugin->getParameters() as $param) { if ($param->getKey() == 'NamespacePrefix') { $filter->setNamespacePrefix($param->getValue()); } } $filterManager->attach('phpDocumentor\\Descriptor\\ConstantDescriptor', $filter); $filterManager->attach('phpDocumentor\\Descriptor\\FunctionDescriptor', $filter); $filterManager->attach('phpDocumentor\\Descriptor\\InterfaceDescriptor', $filter); $filterManager->attach('phpDocumentor\\Descriptor\\TraitDescriptor', $filter); $filterManager->attach('phpDocumentor\\Descriptor\\PropertyDescriptor', $filter); $filterManager->attach('phpDocumentor\\Descriptor\\FileDescriptor', $filter); $filterManager->attach('phpDocumentor\\Descriptor\\ClassDescriptor', $filter); }