本文整理汇总了PHP中PHPUnit_Util_Class::getFunctionSignature方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Class::getFunctionSignature方法的具体用法?PHP PHPUnit_Util_Class::getFunctionSignature怎么用?PHP PHPUnit_Util_Class::getFunctionSignature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Class
的用法示例。
在下文中一共展示了PHPUnit_Util_Class::getFunctionSignature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
//.........这里部分代码省略.........
}
}
$css = '';
if (!$ignore && isset($this->executedLines[$i])) {
$count = '';
// Array: Line is executable and was executed.
// count(Array) = Number of tests that hit this line.
if (is_array($this->executedLines[$i])) {
$color = 'lineCov';
$numTests = count($this->executedLines[$i]);
$count = sprintf('%8d', $numTests);
if ($this->yui) {
$buffer = '';
$testCSS = '';
foreach ($this->executedLines[$i] as $test) {
if (!isset($test->__liHtml)) {
$test->__liHtml = '';
if ($test instanceof PHPUnit_Framework_SelfDescribing) {
$testName = $test->toString();
if ($test instanceof PHPUnit_Framework_TestCase) {
switch ($test->getStatus()) {
case PHPUnit_Runner_BaseTestRunner::STATUS_PASSED:
$testCSS = ' class=\\"testPassed\\"';
break;
case PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE:
$testCSS = ' class=\\"testFailure\\"';
break;
case PHPUnit_Runner_BaseTestRunner::STATUS_ERROR:
$testCSS = ' class=\\"testError\\"';
break;
case PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE:
case PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED:
$testCSS = ' class=\\"testIncomplete\\"';
break;
default:
$testCSS = '';
}
}
}
$test->__liHtml .= sprintf('<li%s>%s</li>', $testCSS, addslashes(htmlspecialchars($testName)));
}
$buffer .= $test->__liHtml;
}
if ($numTests > 1) {
$header = $numTests . ' tests cover';
} else {
$header = '1 test covers';
}
$header .= ' line ' . $i;
$yuiTemplate->setVar(array('line' => $i, 'header' => $header, 'tests' => $buffer), FALSE);
$this->yuiPanelJS .= $yuiTemplate->render();
}
} else {
if ($this->executedLines[$i] == -1) {
$color = 'lineNoCov';
$count = sprintf('%8d', 0);
} else {
$color = 'lineDeadCode';
$count = ' ';
}
}
$css = sprintf('<span class="%s"> %s : ', $color, $count);
}
$fillup = array_shift($this->codeLinesFillup);
if ($fillup > 0) {
$line .= str_repeat(' ', $fillup);
}
$lines .= sprintf('<span class="lineNum" id="container%d"><a name="%d"></a><a href="#%d" id="line%d">%8d</a> </span>%s%s%s' . "\n", $i, $i, $i, $i, $i, !empty($css) ? $css : ' : ', !$this->highlight ? htmlspecialchars($line) : $line, !empty($css) ? '</span>' : '');
$i++;
}
$items = '';
foreach ($this->classes as $className => $classData) {
$numCalledClasses = $classData['executedLines'] > 0 ? 1 : 0;
$calledClassesPercent = $numCalledClasses == 1 ? 100 : 0;
$numCalledMethods = 0;
$numMethods = count($classData['methods']);
foreach ($classData['methods'] as $method) {
if ($method['executedLines'] > 0) {
$numCalledMethods++;
}
}
$items .= $this->doRenderItem(array('name' => sprintf('<b><a href="#%d">%s</a></b>', $classData['startLine'], $className), 'numClasses' => 1, 'numCalledClasses' => $numCalledClasses, 'calledClassesPercent' => sprintf('%01.2f', $calledClassesPercent), 'numMethods' => $numMethods, 'numCalledMethods' => $numCalledMethods, 'calledMethodsPercent' => $this->calculatePercent($numCalledMethods, $numMethods), 'numExecutableLines' => $classData['executableLines'], 'numExecutedLines' => $classData['executedLines'], 'executedLinesPercent' => $this->calculatePercent($classData['executedLines'], $classData['executableLines'])), $lowUpperBound, $highLowerBound);
foreach ($classData['methods'] as $methodName => $methodData) {
$numCalledMethods = $methodData['executedLines'] > 0 ? 1 : 0;
$calledMethodsPercent = $numCalledMethods == 1 ? 100 : 0;
if ($className == '*') {
$signature = PHPUnit_Util_Class::getFunctionSignature(new ReflectionFunction($methodName));
} else {
$signature = PHPUnit_Util_Class::getMethodSignature(new ReflectionMethod($className, $methodName));
}
$items .= $this->doRenderItem(array('name' => sprintf(' <a href="#%d">%s</a>', $methodData['startLine'], $signature), 'numClasses' => '', 'numCalledClasses' => '', 'calledClassesPercent' => '', 'numMethods' => 1, 'numCalledMethods' => $numCalledMethods, 'calledMethodsPercent' => sprintf('%01.2f', $calledMethodsPercent), 'numExecutableLines' => $methodData['executableLines'], 'numExecutedLines' => $methodData['executedLines'], 'executedLinesPercent' => $this->calculatePercent($methodData['executedLines'], $methodData['executableLines'])), $lowUpperBound, $highLowerBound, 'method_item.html');
}
}
$this->setTemplateVars($template, $title, $charset);
$template->setVar(array('lines' => $lines, 'total_item' => $this->renderTotalItem($lowUpperBound, $highLowerBound, FALSE), 'items' => $items, 'yuiPanelJS' => $this->yuiPanelJS));
$cleanId = PHPUnit_Util_Filesystem::getSafeFilename($this->getId());
$template->renderTo($target . $cleanId . '.html');
$this->yuiPanelJS = '';
$this->executedLines = array();
}