예제 #1
0
 private function setTotals(PHP_CodeCoverage_Report_Node $node, PHP_CodeCoverage_Report_XML_Totals $totals)
 {
     $loc = $node->getLinesOfCode();
     $totals->setNumLines($loc['loc'], $loc['cloc'], $loc['ncloc'], $node->getNumExecutableLines(), $node->getNumExecutedLines());
     $totals->setNumClasses($node->getNumClasses(), $node->getNumTestedClasses());
     $totals->setNumTraits($node->getNumTraits(), $node->getNumTestedTraits());
     $totals->setNumMethods($node->getNumMethods(), $node->getNumTestedMethods());
     $totals->setNumFunctions($node->getNumFunctions(), $node->getNumTestedFunctions());
 }
예제 #2
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);
 }