/** * Code Browser for each file with errors * * @param array $errors List of all PHP_CodeBrowser errors * @param string $cbXMLFile Name of the PHP_CodeBrowser error XML file * @param string $projectSource Path to project source files * * @return void * @throws Exception * @see cbErrorHandler::getErrorsByFile * @see cbJSGenerator::getHighlightedSource */ public function generateViewReview($errors, $cbXMLFile, $projectSource) { if (!is_array($errors)) { throw new Exception('Wrong data format for errorlist!'); } $data['title'] = 'Code Browser - Review View'; foreach ($errors as $file) { $data['errors'] = $this->_cbErrorHandler->getErrorsByFile($cbXMLFile, $file['file']); $data['source'] = $this->_cbJSGenerator->getHighlightedSource($file['complete'], $data['errors'], $projectSource); $data['filepath'] = $file['complete']; $data['csspath'] = ''; $depth = substr_count($file['complete'], DIRECTORY_SEPARATOR); for ($i = 1; $i <= $depth; $i++) { $data['csspath'] .= '../'; } $dataGenrate['title'] = $data['title']; $dataGenrate['csspath'] = $data['csspath']; $dataGenrate['content'] = $this->_render('reviewView', $data); $this->_generateView($dataGenrate, $file['complete'] . '.html'); } }
/** * Test if expected javascript source is generated. * Using data provider getErrorsFromFile for getting files with errors. * * @return void * * @dataProvider getErrorsFromFile */ public function testGetJSTree($errors) { $bufferedContent = $this->_cbJSGenerator->getJSTree($errors); $this->assertContains('JSGenerator.php ( <span class="errors">29E</span> | <span class="notices">29N</span> )', $bufferedContent); }