/** * 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; }
/** * Tests cbXMLHandler->countItems() * * @return void * * @group XMLHandler */ public function testCountItems() { $errors = $this->_cbXMLHandler->countItems(simplexml_load_file(self::$_cbXMLFile)->file->children(), 'severity', 'error'); $this->assertEquals($errors, 55); }