/** * Get all the filenames with errors. * * @param string $cbXMLFileName The XML file with all information * * @return array */ public function getFilesWithErrors($cbXMLFileName) { $element = $this->cbXMLHandler->loadXML($cbXMLFileName); $files = null; $path = ''; foreach ($element->children() as $file) { $tmp['complete'] = (string) $file['name']; $tmp['file'] = basename($file['name']); $tmp['path'] = dirname($file['name']); $tmp['count_errors'] = $this->cbXMLHandler->countItems($file->children(), 'severity', 'error'); $tmp['count_notices'] = $this->cbXMLHandler->countItems($file->children(), 'severity', 'notice'); $tmp['count_notices'] += $this->cbXMLHandler->countItems($file->children(), 'severity', 'warning'); $files[] = $tmp; } return $files; }
/** * Prepare some test data for mergin * * @return void */ protected function _prepareXML() { $files = array(); $nodes = array('cpd', 'checkstyle', 'coverage'); foreach ($nodes as $node) { $xml = new DOMDocument('1.0', 'UTF-8'); $xml_parent = $xml->createElement($node); $xml_parent->setAttribute('generated', '3.222'); $xml_parent->setAttribute('phpunit', '3.4.0'); $xml_child = $xml->createElement('childNode', 'That is a small description'); $xml_child->setAttribute('name', 'foobar'); $xml_parent->appendChild($xml_child); $xml->appendChild($xml_parent); $xml->preserveWhiteSpace = false; $xml->formatOutput = true; $this->_cbXMLHandler->addXMLFile($xml); } }