Exemple #1
0
 /**
  * @param PHP_CodeCoverage $coverage
  * @param string           $target
  */
 public function process(PHP_CodeCoverage $coverage, $target)
 {
     $target = $this->getDirectory($target);
     $report = $coverage->getReport();
     unset($coverage);
     if (!isset($_SERVER['REQUEST_TIME'])) {
         $_SERVER['REQUEST_TIME'] = time();
     }
     $date = date('D M j G:i:s T Y', $_SERVER['REQUEST_TIME']);
     $dashboard = new PHP_CodeCoverage_Report_HTML_Renderer_Dashboard($this->templatePath, $this->generator, $date, $this->lowUpperBound, $this->highLowerBound);
     $directory = new PHP_CodeCoverage_Report_HTML_Renderer_Directory($this->templatePath, $this->generator, $date, $this->lowUpperBound, $this->highLowerBound);
     $file = new PHP_CodeCoverage_Report_HTML_Renderer_File($this->templatePath, $this->generator, $date, $this->lowUpperBound, $this->highLowerBound);
     $directory->render($report, $target . 'index.html');
     $dashboard->render($report, $target . 'dashboard.html');
     foreach ($report as $node) {
         $id = $node->getId();
         if ($node instanceof PHP_CodeCoverage_Report_Node_Directory) {
             if (!file_exists($target . $id)) {
                 mkdir($target . $id, 0777, true);
             }
             $directory->render($node, $target . $id . '/index.html');
             $dashboard->render($node, $target . $id . '/dashboard.html');
         } else {
             $dir = dirname($target . $id);
             if (!file_exists($dir)) {
                 mkdir($dir, 0777, true);
             }
             $file->render($node, $target . $id . '.html');
         }
     }
     $this->copyFiles($target);
 }
Exemple #2
0
 /**
  * @param PHP_CodeCoverage $coverage
  * @param string           $target
  */
 public function process(PHP_CodeCoverage $coverage, $target)
 {
     $target = PHP_CodeCoverage_Util::getDirectory($target);
     $report = $coverage->getReport();
     unset($coverage);
     $date = date('D M j G:i:s T Y', $_SERVER['REQUEST_TIME']);
     $dashboard = new PHP_CodeCoverage_Report_HTML_Renderer_Dashboard($this->templatePath, $this->charset, $this->generator, $date, $this->lowUpperBound, $this->highLowerBound);
     $directory = new PHP_CodeCoverage_Report_HTML_Renderer_Directory($this->templatePath, $this->charset, $this->generator, $date, $this->lowUpperBound, $this->highLowerBound);
     $file = new PHP_CodeCoverage_Report_HTML_Renderer_File($this->templatePath, $this->charset, $this->generator, $date, $this->lowUpperBound, $this->highLowerBound, $this->highlight, $this->yui);
     $dashboard->render($report, $target . 'index.dashboard.html', $this->title);
     $directory->render($report, $target . 'index.html', $this->title);
     foreach ($report as $node) {
         $id = $node->getId();
         if ($node instanceof PHP_CodeCoverage_Report_Node_Directory) {
             $dashboard->render($node, $target . $id . '.dashboard.html');
             $directory->render($node, $target . $id . '.html');
         } else {
             $file->render($node, $target . $id . '.html');
         }
     }
     $this->copyFiles($target);
 }