Exemplo n.º 1
0
 public function generate()
 {
     $document = new fDOMDocument();
     // summary
     $root = $document->createElement('phpact');
     $root->setAttribute('project', $this->summary->getProjectName());
     $root->setAttribute('base', $this->summary->getBaseVersion());
     $root->setAttribute('challenger', $this->summary->getChallengerVersion());
     $root->setAttribute('date', date('c', $this->summary->getTime()));
     $root->setAttribute('signature', strip_tags($this->summary->getSignature()));
     // difference list
     $grouped = $this->groupDifferences($this->differences, Difference::UNIT_NAME);
     foreach ($grouped as $unitName => $differences) {
         /* @var $differences \RenanBr\PhpAct\Difference\DifferenceCollection */
         $family = $differences->current()->getTag(Difference::UNIT_FAMILY);
         $unitElement = $root->createElement($family);
         $unitElement->setAttribute('name', $unitName);
         $this->append($unitElement, 'constant', $differences, Difference::CONSTANT_NAME);
         $this->append($unitElement, 'member', $differences, Difference::MEMBER_NAME);
         $this->append($unitElement, 'method', $differences, Difference::METHOD_NAME);
         $root->appendChild($unitElement);
     }
     $document->appendChild($root);
     $document->preserveWhiteSpace = false;
     $document->formatOutput = true;
     return $document->saveXML();
 }
Exemplo n.º 2
0
 /**
  * @return string
  */
 public function renderStripped()
 {
     $dom = new fDOMDocument();
     $dom->preserveWhiteSpace = FALSE;
     $dom->loadXML(preg_replace("/\\s{2,}/u", " ", $this->render()));
     foreach ($dom->query('//comment()') as $c) {
         $c->parentNode->removeChild($c);
     }
     $dom->formatOutput = TRUE;
     return $dom->saveXML();
 }
Exemplo n.º 3
0
 private function showSkeletonConfig($strip)
 {
     $config = file_get_contents(__DIR__ . '/config/skeleton.xml');
     if ($strip) {
         $config = preg_replace("/\\s{2,}/u", " ", $config);
         $dom = new fDOMDocument();
         $dom->preserveWhiteSpace = FALSE;
         $dom->loadXML($config);
         foreach ($dom->query('//comment()') as $c) {
             $c->parentNode->removeChild($c);
         }
         $dom->formatOutput = TRUE;
         $config = $dom->saveXML();
     }
     echo $config;
 }
Exemplo n.º 4
0
 /**
  * @covers TheSeer\phpDox\DocBlock\InvalidElement::asDom
  */
 public function testElementCanBeSerializedToDom()
 {
     $dom = new fDOMDocument();
     $element = new InvalidElement($this->getMock('TheSeer\\phpDox\\DocBlock\\Factory'), 'test');
     $this->assertEquals('<invalid xmlns="http://xml.phpdox.net/src#" annotation="test"/>', $dom->saveXML($element->asDom($dom)));
 }
Exemplo n.º 5
0
 /**
  * @expectedException \TheSeer\fDOM\fDOMException
  */
 public function testSaveXMLThrowsExceptionWithReferenceToNodeFromOtherDocument()
 {
     $dom = new fDOMDocument();
     $this->dom->saveXML($dom->createElement('foo'));
 }