本文整理汇总了PHP中PHP_CodeCoverage_Report_Clover::process方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Report_Clover::process方法的具体用法?PHP PHP_CodeCoverage_Report_Clover::process怎么用?PHP PHP_CodeCoverage_Report_Clover::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage_Report_Clover
的用法示例。
在下文中一共展示了PHP_CodeCoverage_Report_Clover::process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function it_should_run_all_reports(\PHP_CodeCoverage $coverage, \PHP_CodeCoverage_Report_Clover $clover, \PHP_CodeCoverage_Report_PHP $php, SuiteEvent $event, IO $io)
{
$reports = array('clover' => $clover, 'php' => $php);
$this->beConstructedWith($coverage, $reports);
$this->setOptions(array('format' => array('clover', 'php'), 'output' => array('clover' => 'coverage.xml', 'php' => 'coverage.php')));
$this->setIO($io);
$clover->process($coverage, 'coverage.xml')->shouldBeCalled();
$php->process($coverage, 'coverage.php')->shouldBeCalled();
$this->afterSuite($event);
}
示例2: _stopCoverage
protected function _stopCoverage()
{
if (!$this->doCoverage) {
return;
}
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($this->_coverage, ROOT . DS . 'build' . DS . 'logs' . DS . 'clover.xml');
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($this->_coverage, ROOT . DS . 'build' . DS . 'logs' . DS . 'clover' . DS);
}
示例3: createCodeCoverageReport
/**
* Creates code coverage report.
*
* @param \PHP_CodeCoverage $coverage Code coverage collector.
* @return void
*/
public function createCodeCoverageReport(\PHP_CodeCoverage $coverage = null)
{
if (!isset($coverage)) {
echo 'Code coverage analysis unavailable. To enable code coverage, the xdebug php module must be installed and enabled.' . PHP_EOL;
return;
}
echo PHP_EOL . 'Creating code coverage report in clover format ... ';
$writer = new \PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, FULL_PATH . '/clover.xml');
echo 'done' . PHP_EOL;
}
示例4: endTestRun
public function endTestRun()
{
$coverage = $this->result->getCodeCoverage();
if (!empty($coverage)) {
$clover = new PHP_CodeCoverage_Report_Clover();
$contents = $clover->process($coverage);
if ($this->out) {
$this->out->write($contents);
$this->out->close();
}
}
parent::endTestRun();
}
示例5: endTestRun
public function endTestRun()
{
if (version_compare($this->version, '3.5.0') >= 0) {
require_once 'PHP/CodeCoverage/Report/Clover.php';
$coverage = $this->result->getCodeCoverage();
$clover = new PHP_CodeCoverage_Report_Clover();
$contents = $clover->process($coverage);
} else {
require_once 'PHPUnit/Util/Log/CodeCoverage/XML/Clover.php';
$clover = new PHPUnit_Util_Log_CodeCoverage_XML_Clover(null);
ob_start();
$clover->process($this->result);
$contents = ob_get_contents();
ob_end_clean();
}
if ($this->out) {
$this->out->write($contents);
$this->out->close();
}
parent::endTestRun();
}
示例6: testCloverForClassWithAnonymousFunction
/**
* @covers PHP_CodeCoverage_Report_Clover
*/
public function testCloverForClassWithAnonymousFunction()
{
$clover = new PHP_CodeCoverage_Report_Clover();
$this->assertStringMatchesFormatFile(TEST_FILES_PATH . 'class-with-anonymous-function-clover.xml', $clover->process($this->getCoverageForClassWithAnonymousFunction()));
}
示例7: writeCoverageClover
/**
* This method generates a xml coverage report compatible with reports
* generated by clover.
*
* @param PHP_CodeCoverage $coverage The raw coverage data.
*
* @return void
*/
protected function writeCoverageClover(PHP_CodeCoverage $coverage)
{
if ($this->coverageClover) {
$this->writeLine('Writing change coverage data to XML file, this may take a moment.');
$this->writeLine();
$clover = new PHP_CodeCoverage_Report_Clover();
$clover->process($coverage, $this->coverageClover);
}
}
示例8: function
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, __DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'report');
});
}
if ($codeCoverage == 'clover' && $shouldCover) {
$coverage = new PHP_CodeCoverage();
$emitter->on('runner.start', function () use($coverage) {
$coverage->filter()->addDirectoryToWhitelist(__DIR__ . '/src');
$coverage->filter()->removeFileFromWhitelist(__DIR__ . '/src/Dsl.php');
$coverage->start('peridot');
});
$emitter->on('runner.end', function () use($coverage) {
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, __DIR__ . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . 'clover.xml');
});
}
$emitter->on('peridot.start', function (Environment $env) use(&$coverage) {
$definition = $env->getDefinition();
$definition->option("banner", null, InputOption::VALUE_REQUIRED, "Custom banner text");
$definition->getArgument('path')->setDefault('specs');
});
/**
* Demonstrate registering a custom reporter via peridot config
*/
$emitter->on('peridot.reporters', function ($input, $reporters) use(&$counts) {
$banner = $input->getOption('banner');
$reporters->register('basic', 'a simple summary', function (ReporterInterface $reporter) use(&$counts, $banner) {
$output = $reporter->getOutput();
$reporter->getEventEmitter()->on('runner.start', function () use($banner, $output) {
示例9: exit
}
switch ($command) {
case 'list':
Testrunner::search($files);
break;
case 'check':
if (in_array('coverage', $options)) {
$coverage = new PHP_CodeCoverage();
$coverage->filter()->addDirectoryToWhitelist('src');
$coverage->start('Testrunner');
}
$result = Testrunner::compare($files);
if (in_array('coverage', $options)) {
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, 'runner.xml');
echo "\nCoverage saved as runner.xml\n\n";
}
if (!$result) {
echo "[0;31mTestrunner failed, please fix or rebase before building or deploying![0m\n\n";
if (in_array('show', $options)) {
echo file_get_contents('runner.log') . "\n\n";
echo "Done!\n\n";
}
exit(1);
}
break;
case 'compare':
$result = Testrunner::compare($files, true);
if (!$result) {
echo "[0;31mTestrunner failed, please look at runner.log for the details![0m\n\n";
示例10: getToken
passthru('diff -u ' . $caseOut . ' ' . $caseOut . '-got 2>&1');
unlink($caseOut . '-got');
}
}
echo 'Took ', microtime(true) - $start;
if (!is_null($bogomips)) {
echo ' at ', $bogomips, ' bogomips';
}
echo PHP_EOL;
if ($isCoverage && !$isCoveralls) {
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, './cover/');
}
if ($isCoveralls) {
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, './clover.xml');
}
if (sizeof($brokenTests) > 0) {
echo 'run test.php -v to see the error diffs', PHP_EOL;
exit(255);
}
exit(0);
function getToken($token)
{
if (is_string($token)) {
return [$token, $token];
} else {
return $token;
}
}
function bogomips()
示例11: main
/**
* Main method.
*/
public static function main()
{
$input = new ezcConsoleInput();
$input->registerOption(new ezcConsoleOption('', 'clover', ezcConsoleInput::TYPE_STRING));
$input->registerOption(new ezcConsoleOption('', 'html', ezcConsoleInput::TYPE_STRING));
$input->registerOption(new ezcConsoleOption('', 'php', ezcConsoleInput::TYPE_STRING));
$input->registerOption(new ezcConsoleOption('', 'text', ezcConsoleInput::TYPE_STRING));
$input->registerOption(new ezcConsoleOption('', 'blacklist', ezcConsoleInput::TYPE_STRING, array(), TRUE));
$input->registerOption(new ezcConsoleOption('', 'whitelist', ezcConsoleInput::TYPE_STRING, array(), TRUE));
$input->registerOption(new ezcConsoleOption('', 'merge', ezcConsoleInput::TYPE_NONE, FALSE));
$input->registerOption(new ezcConsoleOption('', 'add-uncovered', ezcConsoleInput::TYPE_NONE, FALSE));
$input->registerOption(new ezcConsoleOption('', 'process-uncovered', ezcConsoleInput::TYPE_NONE, FALSE));
$input->registerOption(new ezcConsoleOption('h', 'help', ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
$input->registerOption(new ezcConsoleOption('v', 'version', ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
try {
$input->process();
} catch (ezcConsoleOptionException $e) {
print $e->getMessage() . "\n";
exit(1);
}
if ($input->getOption('help')->value) {
self::showHelp();
exit(0);
} else {
if ($input->getOption('version')->value) {
self::printVersionString();
exit(0);
}
}
$arguments = $input->getArguments();
$clover = $input->getOption('clover')->value;
$html = $input->getOption('html')->value;
$php = $input->getOption('php')->value;
$text = $input->getOption('text')->value;
$blacklist = $input->getOption('blacklist')->value;
$whitelist = $input->getOption('whitelist')->value;
$addUncovered = $input->getOption('add-uncovered')->value;
$processUncovered = $input->getOption('process-uncovered')->value;
$merge = $input->getOption('merge')->value;
if (count($arguments) == 1) {
self::printVersionString();
$coverage = new PHP_CodeCoverage();
$filter = $coverage->filter();
if (empty($whitelist)) {
$c = new ReflectionClass('ezcBase');
$filter->addDirectoryToBlacklist(dirname($c->getFileName()));
$c = new ReflectionClass('ezcConsoleInput');
$filter->addDirectoryToBlacklist(dirname($c->getFileName()));
foreach ($blacklist as $item) {
if (is_dir($item)) {
$filter->addDirectoryToBlacklist($item);
} else {
if (is_file($item)) {
$filter->addFileToBlacklist($item);
}
}
}
} else {
$coverage->setAddUncoveredFilesFromWhitelist($addUncovered);
$coverage->setProcessUncoveredFilesFromWhitelist($processUncovered);
foreach ($whitelist as $item) {
if (is_dir($item)) {
$filter->addDirectoryToWhitelist($item);
} else {
if (is_file($item)) {
$filter->addFileToWhitelist($item);
}
}
}
}
if (!$merge) {
$coverage->start('phpcov');
require $arguments[0];
$coverage->stop();
} else {
$finder = new Symfony\Component\Finder\Finder();
$finder->in($arguments[0])->name('*.cov');
foreach ($finder as $file) {
$coverage->merge(unserialize(file_get_contents($file->getRealpath())));
}
}
if ($clover) {
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, $clover);
}
if ($html) {
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, $html);
}
if ($php) {
$writer = new PHP_CodeCoverage_Report_PHP();
$writer->process($coverage, $php);
}
if ($text) {
$writer = new PHP_CodeCoverage_Report_Text();
$writer->process($coverage, $text);
}
//.........这里部分代码省略.........
示例12: foreach
}
$coverages = [];
$files = $coverageFiles();
foreach ($files as $file) {
$fileCoverage = file_get_contents($file);
if (substr($fileCoverage, 0, 5) === '<?php') {
$coverageObject = (include $file);
$coverages[] = $coverageObject;
}
unlink($file);
}
/**
* Merge all of the results into a single coverage object.
*/
$coverage = array_reduce($coverages, function ($result, $obj) {
if (is_null($result)) {
return $obj;
}
$result->merge($obj);
return $result;
});
//output total coverage
$path = __DIR__ . '/tmp/report';
$writer = new \PHP_CodeCoverage_Report_HTML();
if ($coverageType == 'clover') {
$path = __DIR__ . '/build/logs/clover.xml';
$writer = new \PHP_CodeCoverage_Report_Clover();
}
$writer->process($coverage, $path);
});
};
示例13: main
/**
* Main method.
*/
public function main()
{
$input = new \ezcConsoleInput();
$input->registerOption(new \ezcConsoleOption('', 'clover', \ezcConsoleInput::TYPE_STRING));
$input->registerOption(new \ezcConsoleOption('', 'configuration', \ezcConsoleInput::TYPE_STRING));
$input->registerOption(new \ezcConsoleOption('', 'html', \ezcConsoleInput::TYPE_STRING));
$input->registerOption(new \ezcConsoleOption('', 'php', \ezcConsoleInput::TYPE_STRING));
$input->registerOption(new \ezcConsoleOption('', 'text', \ezcConsoleInput::TYPE_STRING));
$input->registerOption(new \ezcConsoleOption('', 'blacklist', \ezcConsoleInput::TYPE_STRING, array(), TRUE));
$input->registerOption(new \ezcConsoleOption('', 'whitelist', \ezcConsoleInput::TYPE_STRING, array(), TRUE));
$input->registerOption(new \ezcConsoleOption('', 'merge', \ezcConsoleInput::TYPE_NONE, FALSE));
$input->registerOption(new \ezcConsoleOption('', 'add-uncovered', \ezcConsoleInput::TYPE_NONE, FALSE));
$input->registerOption(new \ezcConsoleOption('', 'process-uncovered', \ezcConsoleInput::TYPE_NONE, FALSE));
$input->registerOption(new \ezcConsoleOption('h', 'help', \ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
$input->registerOption(new \ezcConsoleOption('v', 'version', \ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
try {
$input->process();
} catch (ezcConsoleOptionException $e) {
print $e->getMessage() . "\n";
exit(1);
}
if ($input->getOption('help')->value) {
$this->showHelp();
exit(0);
} else {
if ($input->getOption('version')->value) {
$this->printVersionString();
exit(0);
}
}
$arguments = $input->getArguments();
$clover = $input->getOption('clover')->value;
$configuration = $input->getOption('configuration')->value;
$html = $input->getOption('html')->value;
$php = $input->getOption('php')->value;
$text = $input->getOption('text')->value;
$blacklist = $input->getOption('blacklist')->value;
$whitelist = $input->getOption('whitelist')->value;
$addUncovered = $input->getOption('add-uncovered')->value;
$processUncovered = $input->getOption('process-uncovered')->value;
$merge = $input->getOption('merge')->value;
$coverage = new \PHP_CodeCoverage();
$filter = $coverage->filter();
if ($configuration) {
$this->handleConfiguration($configuration, $coverage);
}
if (count($arguments) == 1) {
$this->printVersionString();
if (empty($whitelist)) {
$c = new \ReflectionClass('ezcBase');
$filter->addDirectoryToBlacklist(dirname($c->getFileName()));
$c = new \ReflectionClass('ezcConsoleInput');
$filter->addDirectoryToBlacklist(dirname($c->getFileName()));
foreach ($blacklist as $item) {
if (is_dir($item)) {
$filter->addDirectoryToBlacklist($item);
} else {
if (is_file($item)) {
$filter->addFileToBlacklist($item);
}
}
}
} else {
$coverage->setAddUncoveredFilesFromWhitelist($addUncovered);
$coverage->setProcessUncoveredFilesFromWhitelist($processUncovered);
foreach ($whitelist as $item) {
if (is_dir($item)) {
$filter->addDirectoryToWhitelist($item);
} else {
if (is_file($item)) {
$filter->addFileToWhitelist($item);
}
}
}
}
if (!$merge) {
$coverage->start('phpcov');
require $arguments[0];
$coverage->stop();
} else {
$facade = new \File_Iterator_Facade();
$files = $facade->getFilesAsArray($arguments[0], '.cov');
foreach ($files as $file) {
$coverage->merge(unserialize(file_get_contents($file)));
}
}
if ($clover) {
print "\nGenerating code coverage report in Clover XML format ...";
$writer = new \PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, $clover);
print " done\n";
}
if ($html) {
print "\nGenerating code coverage report in HTML format ...";
$writer = new \PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, $html);
print " done\n";
//.........这里部分代码省略.........
示例14: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
*
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($arguments);
if (isset($arguments['bootstrap'])) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}
if ($arguments['backupGlobals'] === false) {
$suite->setBackupGlobals(false);
}
if ($arguments['backupStaticAttributes'] === true) {
$suite->setBackupStaticAttributes(true);
}
if (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest($test);
}
$result = $this->createTestResult();
if (!$arguments['convertErrorsToExceptions']) {
$result->convertErrorsToExceptions(false);
}
if (!$arguments['convertNoticesToExceptions']) {
PHPUnit_Framework_Error_Notice::$enabled = false;
}
if (!$arguments['convertWarningsToExceptions']) {
PHPUnit_Framework_Error_Warning::$enabled = false;
}
if ($arguments['stopOnError']) {
$result->stopOnError(true);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(true);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(true);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(true);
}
if ($this->printer === null) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$this->printer = new PHPUnit_TextUI_ResultPrinter(null, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
self::$versionStringPrinted = true;
if (isset($arguments['configuration'])) {
$this->printer->write(sprintf("Configuration read from %s\n\n", $arguments['configuration']->getFilename()));
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger());
}
if (isset($arguments['testdoxHTMLFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
$codeCoverageReports = 0;
if (extension_loaded('xdebug')) {
if (isset($arguments['coverageClover'])) {
$codeCoverageReports++;
}
if (isset($arguments['reportDirectory'])) {
$codeCoverageReports++;
}
if (isset($arguments['coveragePHP'])) {
$codeCoverageReports++;
}
if (isset($arguments['coverageText'])) {
$codeCoverageReports++;
}
}
if ($codeCoverageReports > 0) {
$codeCoverage = new PHP_CodeCoverage(null, $this->codeCoverageFilter);
$codeCoverage->setAddUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
$codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['processUncoveredFilesFromWhitelist']);
if (isset($arguments['forceCoversAnnotation'])) {
$codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
}
if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
$codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
}
$result->setCodeCoverage($codeCoverage);
}
if ($codeCoverageReports > 1) {
//.........这里部分代码省略.........
示例15: printXml
protected function printXml()
{
$writer = new \PHP_CodeCoverage_Report_Clover();
$writer->process(self::$coverage, $this->absolutePath($this->options['coverage-xml']));
}