Exemplo n.º 1
0
 /**
  * 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');
     }
 }
 /**
  * In case of emty xml file, empty array should be returned.
  * 
  * SimpleXMLObject is generated by MockObject.
  * 
  * @return void
  */
 public function testGetErrorsByFileEmpty()
 {
     $this->_mockXMLHandler->expects($this->once())->method('loadXML')->with($this->equalTo(self::$_cbXMLBasic))->will($this->returnValue(simplexml_load_file(self::$_cbXMLBasic)));
     $list = $this->_cbErrorHandler->getErrorsByFile(self::$_cbXMLBasic, $this->_fileName);
     $this->assertTrue(is_array($list) && empty($list));
 }