Exemplo n.º 1
0
 /**
  * @param fDOMElement $element
  * @param string $elementName
  * @param Difference[] $differences
  * @param string $tagName
  */
 private function append(fDOMElement $unitElement, $elementName, DifferenceCollection $differences, $tagName)
 {
     $grouped = $this->groupDifferences($differences, $tagName);
     foreach ($grouped as $groupName => $subDifferences) {
         $parent = $unitElement->createElement($elementName);
         $parent->setAttribute('name', $groupName);
         foreach ($subDifferences as $name => $difference) {
             /* @var $difference \RenanBr\PhpAct\Difference\Difference */
             $element = $parent->createElement('difference');
             $element->appendXML($difference->getMessage());
             $isBcBreak = $difference->hasTag(Difference::BC_BREAK);
             $element->setAttribute('bcBreak', $isBcBreak ? 'true' : 'false');
             $parent->appendChild($element);
         }
         $unitElement->appendChild($parent);
     }
 }