/** * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct * @covers phpDocumentor\Descriptor\ProjectDescriptor::setName * @covers phpDocumentor\Descriptor\ProjectDescriptor::getName */ public function testGetSetName() { $this->assertEquals(self::EXAMPLE_NAME, $this->fixture->getName()); $newProjectName = 'Renamed'; $this->fixture->setName($newProjectName); $this->assertEquals($newProjectName, $this->fixture->getName()); }
/** * This method generates the AST output * * @param ProjectDescriptor $project Document containing the structure. * @param Transformation $transformation Transformation to execute. * * @return void */ public function transform(ProjectDescriptor $project, Transformation $transformation) { $artifact = $this->getDestinationPath($transformation); $this->xml = new \DOMDocument('1.0', 'utf-8'); $this->xml->formatOutput = true; $document_element = new \DOMElement('project'); $this->xml->appendChild($document_element); $document_element->setAttribute('title', $project->getName()); $document_element->setAttribute('version', Application::$VERSION); $transformer = $transformation->getTransformer(); foreach ($project->getFiles() as $file) { $this->buildFile($document_element, $file, $transformer); } $this->finalize($project); file_put_contents($artifact, $this->xml->saveXML()); }