本文整理汇总了PHP中xdebug_stop_code_coverage函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_stop_code_coverage函数的具体用法?PHP xdebug_stop_code_coverage怎么用?PHP xdebug_stop_code_coverage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdebug_stop_code_coverage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
protected function tearDown()
{
xdebug_stop_code_coverage(false);
$this->clearEntity($this->method);
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
parent::tearDown();
}
示例2: stop
/**
* Stop collection of code coverage information.
*
* @return array
*/
public function stop()
{
// @codeCoverageIgnoreStart
$codeCoverage = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
return $codeCoverage;
// @codeCoverageIgnoreEnd
}
示例3: stopCodeCoverage
public static function stopCodeCoverage()
{
if (function_exists('xdebug_stop_code_coverage') && self::$coverageStopped === false) {
self::$coverageStopped = xdebug_stop_code_coverage(false);
return self::$coverageStopped;
}
return;
}
示例4: pauseCodeCoverageAnalysis
public static function pauseCodeCoverageAnalysis()
{
if (false === self::isCodeCoverageAnalysisRunning()) {
return;
}
self::collectCodeCoverageReport();
xdebug_stop_code_coverage(false);
self::$m_isCodeCoverageAnalysisRunning = false;
}
示例5: paintGroupEnd
/**
* Paints the end of a group test. Will paint the page
* footer if the stack of tests has unwound.
* @param string $test_name Name of test that is ending.
* @param integer $progress Number of test cases ending.
*/
function paintGroupEnd($test_name)
{
if (extension_loaded('xdebug')) {
$this->code_coverage = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
ksort($this->code_coverage);
}
HtmlReporter::paintGroupEnd($test_name);
}
示例6: save_coverage_data
function save_coverage_data($test_id)
{
$data = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], 0777, true);
}
$file = $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] . '/' . $test_id . '.' . md5(uniqid(rand(), true));
echo "Saving coverage data to {$file}...\n";
file_put_contents($file, serialize($data));
}
示例7: stopCodeCoverage
public function stopCodeCoverage()
{
//echo "stopCodeCoverage called...\n";
if (extension_loaded('xdebug')) {
$data = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
//echo "xdebug_stop_code_coverage called...\n";
global $CDASH_COVERAGE_DIR;
$file = $CDASH_COVERAGE_DIR . DIRECTORY_SEPARATOR . md5($_SERVER['SCRIPT_FILENAME']);
file_put_contents($file . '.' . md5(uniqid(rand(), true)) . '.' . get_class(), serialize($data));
}
}
示例8: stop
/**
* Stops code coverage.
*
* @return array The collected coverage
*/
public function stop()
{
$data = xdebug_get_code_coverage();
xdebug_stop_code_coverage($this->_config['cleanup']);
$result = [];
foreach ($data as $file => $coverage) {
foreach ($coverage as $line => $value) {
if ($line && $value !== -2) {
$result[$file][$line - 1] = $value === -1 ? 0 : $value;
}
}
}
return $result;
}
示例9: stop
public static function stop($reportDir = null)
{
if ($reportDir !== null) {
self::initialize($reportDir);
}
if (function_exists('xdebug_start_code_coverage')) {
$userStory = self::getUserStoryFromFile();
self::updateCodeCoverageReports($userStory);
// some session handlers, close() for example, will be called after main script finished executing, so if we call CodeCoverage::stop()
// and xdebug is stopped then it will be implossible to get code coverage stats for such session handlers.
xdebug_stop_code_coverage(true);
}
self::generateHtmlReports($reportDir);
}
示例10: stop
/**
* Stop collection of code coverage information and store it in Sqlite3.
*
* @return array
*/
public function stop()
{
$cov = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
if (!isset($this->root)) {
$this->root = getcwd();
}
$dataHandler = new DataHandler(self::SQLITE_DB);
chdir($this->root);
$dataHandler->write($cov);
$cleanData = $this->cleanup($dataHandler->read());
unset($dataHandler);
// release sqlite connection
return $cleanData;
}
示例11: apply
/**
* Takes an instance of an object (usually a Collection object) containing test
* instances. Attaches code coverage filtering to test cases.
*
* @see lithium\test\filter\Coverage::collect()
* @param object $report Instance of Report which is calling apply.
* @param array $tests The test to apply this filter on
* @param array $options Options for how code coverage should be applied. These options are
* also passed to `Coverage::collect()` to determine how to aggregate results. See
* the documentation for `collect()` for further options. Options affecting this
* method are:
* -'method': The name of method to attach to, defaults to 'run'.
* @return object|void Returns the instance of `$tests` with code coverage analysis
* triggers applied.
*/
public static function apply($report, $tests, array $options = array())
{
$defaults = array('method' => 'run');
$options += $defaults;
$m = $options['method'];
$filter = function ($self, $params, $chain) use($report, $options) {
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$chain->next($self, $params, $chain);
$results = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
$report->collect(__CLASS__, array($self->subject() => $results));
};
$tests->invoke('applyFilter', array($m, $filter));
return $tests;
}
示例12: endDebug
function endDebug()
{
if (defined('SH_DEBUG_VERIFY_FOLDER') && is_dir(SH_DEBUG_VERIFY_FOLDER)) {
if (defined('SH_DEBUG_COVERAGE_PAGE')) {
$linker = sh_linker::getInstance();
if (file_exists(SH_DEBUG_COVERAGE_PAGE)) {
include SH_DEBUG_COVERAGE_PAGE;
} else {
$coverage = array();
}
$all_elements = debug_get_coverage($coverage);
$linker->helper->writeArrayInFile(SH_DEBUG_COVERAGE_PAGE, "coverage", $all_elements);
xdebug_stop_code_coverage();
}
}
}
示例13: apply
/**
* Takes an instance of an object (usually a Collection object) containing test
* instances. Attaches code coverage filtering to test cases.
*
* @see lithium\test\filter\Coverage::collect()
* @param object $report Instance of Report which is calling apply.
* @param array $tests The test to apply this filter on
* @param array $options Options for how code coverage should be applied. These options are
* also passed to `Coverage::collect()` to determine how to aggregate results. See
* the documentation for `collect()` for further options. Options affecting this
* method are:
* -'method': The name of method to attach to, defaults to 'run'.
* @return object Returns the instance of `$tests` with code coverage analysis
* triggers applied.
*/
public static function apply($report, $tests, array $options = array())
{
$defaults = array('method' => 'run');
$options += $defaults;
if (!function_exists('xdebug_start_code_coverage')) {
$msg = "Xdebug not installed. Please install Xdebug before running code coverage.";
throw new RuntimeException($msg);
}
$filter = function ($self, $params, $chain) use($report, $options) {
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$chain->next($self, $params, $chain);
$results = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
$report->collect(__CLASS__, array($self->subject() => $results));
};
$tests->invoke('applyFilter', array($options['method'], $filter));
return $tests;
}
示例14: paintFooter
function paintFooter($test_name)
{
if (extension_loaded('xdebug')) {
$this->coverage = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
}
$colour = $this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green";
print "<div style=\"";
print "padding: 8px; margin-top: 1em; background-color: {$colour}; color: white;";
print "\">";
print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();
print " test cases complete:\n";
print "<strong>" . $this->getPassCount() . "</strong> passes, ";
print "<strong>" . $this->getFailCount() . "</strong> fails and ";
print "<strong>" . $this->getExceptionCount() . "</strong> exceptions.";
print "</div>\n";
$this->paintCoverage();
print "</body>\n</html>\n";
}
示例15: save_code_coverage
function save_code_coverage()
{
$coverage_directory = "/home/alice/twfy-coverage/";
if (!file_exists($coverage_directory)) {
mkdir($coverage_directory, 0777, TRUE);
}
global $coverage_identifier;
$output_filename = $coverage_directory . $coverage_identifier;
$coverage_data = xdebug_get_code_coverage();
$fp = fopen($output_filename, "w");
fwrite($fp, $output_filename . "\n");
foreach ($coverage_data as $filename => $line_map) {
fwrite($fp, $filename . "\n");
foreach ($line_map as $line_number => $number_of_uses) {
fwrite($fp, " " . $line_number . ": " . $number_of_uses . "\n");
}
}
fclose($fp);
xdebug_stop_code_coverage();
}