/**
  * Test if proper content is generated.
  * It is expeceted that source code from file is present and error Highlighting
  * is resolved the right way.
  *
  * @return void
  */
 public function testGetHighlightedSource()
 {
     $mockErrors = unserialize(file_get_contents(self::$_serializedErrors));
     $this->_mockFDHandler->expects($this->once())->method('loadFile')->with($this->equalTo(PHPCB_TEST_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'MyJSGenerator.php'))->will($this->returnValue(trim(file_get_contents(PHPCB_TEST_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'JSTestGenerator.php'))));
     $content = $this->_cbJSGenerator->getHighlightedSource('MyJSGenerator.php', $mockErrors['b0456446720360d02791c1a3d143f703'], PHPCB_TEST_DIR . DIRECTORY_SEPARATOR . 'src');
     $this->assertNotNull($content);
     $this->assertContains('<li id="line-249" class="white"><a name="line-249"></a><code><span class="comment">', $content);
     $this->assertContains('<li id="line-250-254" class="moreErrors" ><ul><li id="line-250" class="transparent"><a name="line-250"></a><code><span class="comment">    </span><span class="keyword">private function </span><span class="default">getFoldersFilesTree </span><span class="keyword">(</span><span class="default">$files</span><span class="keyword">)</span></code></li>', $content);
     $this->assertContains('<li id="line-251" class="transparent"><a name="line-251"></a><code><span class="keyword">', $content);
     $this->assertTrue((int) substr_count($content, '<ul>', 0) == (int) substr_count($content, '</ul>', 0));
     $this->assertTrue((int) substr_count($content, '<li ', 0) == (int) substr_count($content, '</li>', 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');
     }
 }