Esempio n. 1
0
 protected function getPathToRoot(PHP_CodeCoverage_Report_Node $node)
 {
     $id = $node->getId();
     $depth = substr_count($id, '/');
     if ($id != 'index' && $node instanceof PHP_CodeCoverage_Report_Node_Directory) {
         $depth++;
     }
     return str_repeat('../', $depth);
 }
Esempio n. 2
0
 protected function getActiveBreadcrumb(PHP_CodeCoverage_Report_Node $node, $isDirectory)
 {
     return sprintf('        <li><a href="%s.html">%s</a></li>' . "\n" . '        <li class="active">(Dashboard)</li>' . "\n", $node->getId(), $node->getName());
 }
Esempio n. 3
0
 /**
  * @param Text_Template                $template
  * @param PHP_CodeCoverage_Report_Node $node
  */
 protected function setCommonTemplateVariables(Text_Template $template, PHP_CodeCoverage_Report_Node $node)
 {
     $template->setVar(array('id' => $node->getId(), 'full_path' => $node->getPath(), 'breadcrumbs' => $this->getBreadcrumbs($node), 'charset' => $this->charset, 'date' => $this->date, 'version' => PHP_CodeCoverage_Version::id(), 'php_version' => PHP_VERSION, 'generator' => $this->generator, 'low_upper_bound' => $this->lowUpperBound, 'high_lower_bound' => $this->highLowerBound));
 }
Esempio n. 4
0
 protected function getInactiveBreadcrumb(PHP_CodeCoverage_Report_Node $node)
 {
     return sprintf('        <li><a href="%s.html">%s</a> <span class="divider">/</span></li>' . "\n", $node->getId(), $node->getName());
 }
Esempio n. 5
0
 /**
  * @param  PHP_CodeCoverage_Report_Node $item
  * @param  boolean                      $total
  * @return string
  */
 protected function renderItem(PHP_CodeCoverage_Report_Node $item, $total = FALSE)
 {
     $data = array('numClasses' => $item->getNumClasses(), 'numTestedClasses' => $item->getNumTestedClasses(), 'numMethods' => $item->getNumMethods(), 'numTestedMethods' => $item->getNumTestedMethods(), 'linesExecutedPercent' => $item->getLineExecutedPercent(FALSE), 'linesExecutedPercentAsString' => $item->getLineExecutedPercent(), 'numExecutedLines' => $item->getNumExecutedLines(), 'numExecutableLines' => $item->getNumExecutableLines(), 'testedMethodsPercent' => $item->getTestedMethodsPercent(FALSE), 'testedMethodsPercentAsString' => $item->getTestedMethodsPercent(), 'testedClassesPercent' => $item->getTestedClassesPercent(FALSE), 'testedClassesPercentAsString' => $item->getTestedClassesPercent());
     if ($total) {
         $data['itemClass'] = 'coverDirectory';
         $data['name'] = 'Total';
     } else {
         $data['name'] = sprintf('<a href="%s.html">%s</a>', $item->getId(), $item->getName());
         if ($item instanceof PHP_CodeCoverage_Report_Node_Directory) {
             $data['icon'] = '<img alt="directory" src="directory.png"/> ';
             $data['itemClass'] = 'coverDirectory';
         } else {
             $data['icon'] = '<img alt="file" src="file.png"/> ';
             $data['itemClass'] = 'coverFile';
         }
     }
     return $this->renderItemTemplate(new Text_Template($this->templatePath . 'directory_item.html'), $data);
 }
Esempio n. 6
0
 /**
  * @param Text_Template                $template
  * @param PHP_CodeCoverage_Report_Node $node
  */
 protected function setCommonTemplateVariables(Text_Template $template, PHP_CodeCoverage_Report_Node $node)
 {
     $runtime = new Runtime();
     $template->setVar(array('id' => $node->getId(), 'full_path' => $node->getPath(), 'path_to_root' => $this->getPathToRoot($node), 'breadcrumbs' => $this->getBreadcrumbs($node), 'date' => $this->date, 'version' => $this->version, 'runtime_name' => $runtime->getName(), 'runtime_version' => $runtime->getVersion(), 'runtime_link' => $runtime->getVendorUrl(), 'generator' => $this->generator, 'low_upper_bound' => $this->lowUpperBound, 'high_lower_bound' => $this->highLowerBound));
 }
Esempio n. 7
0
 /**
  * @param  PHP_CodeCoverage_Report_Node $item
  * @param  boolean                      $total
  * @return string
  */
 protected function renderItem(PHP_CodeCoverage_Report_Node $item, $total = FALSE)
 {
     $data = array('numClasses' => $item->getNumClassesAndTraits(), 'numTestedClasses' => $item->getNumTestedClassesAndTraits(), 'numMethods' => $item->getNumMethods(), 'numTestedMethods' => $item->getNumTestedMethods(), 'linesExecutedPercent' => $item->getLineExecutedPercent(FALSE), 'linesExecutedPercentAsString' => $item->getLineExecutedPercent(), 'numExecutedLines' => $item->getNumExecutedLines(), 'numExecutableLines' => $item->getNumExecutableLines(), 'testedMethodsPercent' => $item->getTestedMethodsPercent(FALSE), 'testedMethodsPercentAsString' => $item->getTestedMethodsPercent(), 'testedClassesPercent' => $item->getTestedClassesAndTraitsPercent(FALSE), 'testedClassesPercentAsString' => $item->getTestedClassesAndTraitsPercent());
     if ($total) {
         $data['name'] = 'Total';
     } else {
         $data['name'] = sprintf('<a href="%s.html">%s</a>', $item->getId(), $item->getName());
         if ($item instanceof PHP_CodeCoverage_Report_Node_Directory) {
             $data['icon'] = '<i class="icon-folder-open"></i> ';
         } else {
             $data['icon'] = '<i class="icon-file"></i> ';
         }
     }
     return $this->renderItemTemplate(new Text_Template($this->templatePath . 'directory_item.html', '{{', '}}'), $data);
 }
Esempio n. 8
0
 protected function getActiveBreadcrumb(PHP_CodeCoverage_Report_Node $node, $isDirectory)
 {
     $buffer = sprintf('        <li class="active">%s</li>' . "\n", $node->getName());
     if ($isDirectory) {
         $buffer .= sprintf('        <li>(<a href="%s.dashboard.html">Dashboard</a>)</li>' . "\n", $node->getId());
     }
     return $buffer;
 }