Пример #1
0
 /**
  * @param \Text_Template $template
  *
  * @return string
  */
 protected function renderFunctionOrMethodItem(\Text_Template $template, array $item, $indent = '')
 {
     $numTestedItems = $item['executedLines'] == $item['executableLines'] ? 1 : 0;
     return $this->renderItemTemplate($template, ['name' => sprintf('%s<a href="#%d"><abbr title="%s">%s</abbr></a>', $indent, $item['startLine'], htmlspecialchars($item['signature']), isset($item['functionName']) ? $item['functionName'] : $item['methodName']), 'numMethods' => 1, 'numTestedMethods' => $numTestedItems, 'linesExecutedPercent' => Util::percent($item['executedLines'], $item['executableLines'], false), 'linesExecutedPercentAsString' => Util::percent($item['executedLines'], $item['executableLines'], true), 'numExecutedLines' => $item['executedLines'], 'numExecutableLines' => $item['executableLines'], 'testedMethodsPercent' => Util::percent($numTestedItems, 1, false), 'testedMethodsPercentAsString' => Util::percent($numTestedItems, 1, true), 'crap' => $item['crap']]);
 }
Пример #2
0
 protected function printCoverageCounts($numberOfCoveredElements, $totalNumberOfElements, $precision)
 {
     $format = '%' . $precision . 's';
     return Util::percent($numberOfCoveredElements, $totalNumberOfElements, true, true) . ' (' . sprintf($format, $numberOfCoveredElements) . '/' . sprintf($format, $totalNumberOfElements) . ')';
 }
Пример #3
0
 public function setNumFunctions($count, $tested)
 {
     $this->functionsNode->setAttribute('count', $count);
     $this->functionsNode->setAttribute('tested', $tested);
     $this->functionsNode->setAttribute('percent', Util::percent($tested, $count, true));
 }
Пример #4
0
 /**
  * Returns the percentage of executed lines.
  *
  * @param bool $asString
  *
  * @return int
  */
 public function getLineExecutedPercent($asString = true)
 {
     return Util::percent($this->getNumExecutedLines(), $this->getNumExecutableLines(), $asString);
 }