コード例 #1
0
 /**
  * Parse a source folder generating error list and mergin existing errors in this
  * list, if path/file matching is found.
  * In this case one substitution takes place.
  * 
  * @return void
  */
 public function testParseCommonSourcePathSubstitution()
 {
     $test = array(array('complete' => 'src' . DIRECTORY_SEPARATOR . 'XMLGenerator.php', 'path' => '/path/to/my/files', 'file' => 'XMLGenerator.php', 'count_errors' => 10, 'count_notices' => 12), array('complete' => 'Plugins' . DIRECTORY_SEPARATOR . 'ErrorCPD.php', 'path' => '/path/to/my/files', 'file' => 'ErrorCPD.php', 'count_errors' => 10, 'count_notices' => 12));
     $result = $this->_cbErrorHandler->parseSourceDirectory(PHPCB_ROOT_DIR, $test);
     $this->assertEquals('XMLGenerator.php', $result['src' . DIRECTORY_SEPARATOR . 'XMLGenerator.php']['file']);
     $this->assertEquals(10, $result['src' . DIRECTORY_SEPARATOR . 'XMLGenerator.php']['count_errors']);
     $this->assertEquals('ErrorCPD.php', $result['src' . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . 'ErrorCPD.php']['file']);
     $this->assertEquals(0, $result['src' . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . 'ErrorCPD.php']['count_errors']);
 }
コード例 #2
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');
     }
 }