本文整理汇总了PHP中PHP_CodeCoverage_Report_PHP::process方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Report_PHP::process方法的具体用法?PHP PHP_CodeCoverage_Report_PHP::process怎么用?PHP PHP_CodeCoverage_Report_PHP::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage_Report_PHP
的用法示例。
在下文中一共展示了PHP_CodeCoverage_Report_PHP::process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __destruct
/**
* Save report
*/
public function __destruct()
{
if ($this->_coverage) {
$this->_coverage->stop();
$report = new PHP_CodeCoverage_Report_PHP();
$report->process($this->_coverage, $this->_covResult);
}
}
示例2: 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);
}
示例3: 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";
//.........这里部分代码省略.........
示例4: function
*/
$emitter->on('runner.start', function () use($covered) {
$covered(function ($token, \PHP_CodeCoverage $coverage) {
$coverage->filter()->addDirectoryToWhitelist(__DIR__ . '/src');
$coverage->start($token);
});
});
/**
* When a runner ends out of process, write it to a temp file.
*/
$emitter->on('runner.end', function () use($covered) {
$covered(function ($token, \PHP_CodeCoverage $coverage) {
$coverage->stop();
$writer = new \PHP_CodeCoverage_Report_PHP();
$file = tempnam(sys_get_temp_dir(), "PCC_{$token}_");
$writer->process($coverage, $file);
});
});
/**
* When peridot ends in the main process, we aggregate all of our code coverage
* results.
*/
$emitter->on('peridot.end', function () use($coverageType, $coverageFiles, $hhvm) {
if (!$coverageType || $hhvm) {
return;
}
$coverages = [];
$files = $coverageFiles();
foreach ($files as $file) {
$fileCoverage = file_get_contents($file);
if (substr($fileCoverage, 0, 5) === '<?php') {
示例5: 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'])) {
$suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
}
$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 && !self::$versionStringPrinted) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
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']));
}
if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory']) || isset($arguments['coveragePHP']) || isset($arguments['coverageText'])) && extension_loaded('xdebug')) {
$codeCoverage = new PHP_CodeCoverage(NULL, $this->codeCoverageFilter);
$codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
if (isset($arguments['cacheTokens'])) {
$codeCoverage->setCacheTokens($arguments['cacheTokens']);
}
if (isset($arguments['forceCoversAnnotation'])) {
$codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
}
if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
$codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
}
$result->setCodeCoverage($codeCoverage);
}
if (isset($arguments['jsonLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
}
if (isset($arguments['tapLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
}
if (isset($arguments['junitLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
}
if ($arguments['strict']) {
$result->strictMode(TRUE);
$result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']);
$result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']);
$result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']);
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
$result->flushListeners();
//.........这里部分代码省略.........
示例6: printPHP
protected function printPHP()
{
$writer = new \PHP_CodeCoverage_Report_PHP();
$writer->process(self::$coverage, $this->absolutePath($this->options['coverage']));
}
示例7: shutdown
public function shutdown(PHP_CodeCoverage $coverage)
{
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_PHP();
$writer->process($coverage, __DIR__ . '/../../../build/logs/clover-child.cov');
}
示例8: php
/**
* Generate php coverage report
* @param string $target Report filename
*/
public function php($target)
{
$php = new \PHP_CodeCoverage_Report_PHP();
$php->process($this->coverage, $target);
}
示例9: _createReports
/**
* Stop or pause coverage proccess
*/
protected function _createReports()
{
if (!$this->_coverage) {
return;
}
$reportXmlDir = $this->_config->get('build_xml');
if ($this->_config->get('xml', true, 'bool')) {
$this->_checkDir($reportXmlDir);
$report = new \PHP_CodeCoverage_Report_Clover();
$report->process($this->_coverage, $reportXmlDir . '/' . $this->_hash . '.xml');
}
$reportCovDir = $this->_config->get('build_cov');
if ($this->_config->get('cov', false, 'bool')) {
$this->_checkDir($reportCovDir);
$report = new \PHP_CodeCoverage_Report_PHP();
$report->process($this->_coverage, $reportCovDir . '/' . $this->_hash . '.cov');
}
$reportHtmlDir = $this->_config->get('build_html');
if ($this->_config->get('html', false, 'bool')) {
$this->_checkDir($reportHtmlDir);
$report = new \PHP_CodeCoverage_Report_HTML();
$report->process($this->_coverage, $reportHtmlDir . '/' . $this->_hash);
}
}
示例10: logCoverage
/**
* Write coverage to file if requested
*/
private function logCoverage()
{
if (!$this->hasCoverage()) {
return;
}
$filteredOptions = $this->options->filtered;
if (isset($filteredOptions['coverage-clover'])) {
$clover = new \PHP_CodeCoverage_Report_Clover();
$clover->process($this->getCoverage()->getCoverage(), $filteredOptions['coverage-clover']);
}
if (isset($filteredOptions['coverage-html'])) {
$html = new \PHP_CodeCoverage_Report_HTML();
$html->process($this->getCoverage()->getCoverage(), $filteredOptions['coverage-html']);
}
$php = new \PHP_CodeCoverage_Report_PHP();
$php->process($this->getCoverage()->getCoverage(), $filteredOptions['coverage-php']);
}
示例11: getmypid
<?php
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_PHP();
$objectName = 'proc_' . getmypid() . '_' . uniqid();
$writer->process($coverage, __DIR__ . '/../../../build/coverage-parts/' . $objectName . '.cov');
示例12: 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);
}
//.........这里部分代码省略.........
示例13: handleReports
private function handleReports(\PHP_CodeCoverage $coverage)
{
if ($this->clover) {
$this->log("Generating code coverage report in Clover XML format ...");
$writer = new \PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, $this->clover);
}
if ($this->crap4j) {
$this->log("Generating code coverage report in Crap4J XML format...");
$writer = new \PHP_CodeCoverage_Report_Crap4j();
$writer->process($coverage, $this->crap4j);
}
if ($this->html) {
$this->log("Generating code coverage report in HTML format ...");
$writer = new \PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, $this->html);
}
if ($this->php) {
$this->log("Generating code coverage report in PHP format ...");
$writer = new \PHP_CodeCoverage_Report_PHP();
$writer->process($coverage, $this->php);
}
if ($this->text) {
$writer = new \PHP_CodeCoverage_Report_Text(50, 90, false, false);
$writer->process($coverage, $this->text);
}
}
示例14: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @param bool $exit
*
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = [], $exit)
{
if (isset($arguments['configuration'])) {
$GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration'];
}
$this->handleConfiguration($arguments);
$this->processSuiteFilters($suite, $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 ($arguments['beStrictAboutChangesToGlobalState'] === true) {
$suite->setbeStrictAboutChangesToGlobalState(true);
}
if (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $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['stopOnWarning']) {
$result->stopOnWarning(true);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(true);
}
if ($arguments['stopOnRisky']) {
$result->stopOnRisky(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 {
$printerClass = 'PHPUnit_TextUI_ResultPrinter';
if (isset($arguments['printer']) && is_string($arguments['printer']) && class_exists($arguments['printer'], false)) {
$class = new ReflectionClass($arguments['printer']);
if ($class->isSubclassOf('PHPUnit_TextUI_ResultPrinter')) {
$printerClass = $arguments['printer'];
}
}
$this->printer = new $printerClass(isset($arguments['stderr']) ? 'php://stderr' : null, $arguments['verbose'], $arguments['colors'], $arguments['debug'], $arguments['columns'], $arguments['reverseList']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n");
self::$versionStringPrinted = true;
if ($arguments['verbose']) {
$runtime = $this->runtime->getNameWithVersion();
if ($this->runtime->hasXdebug()) {
$runtime .= sprintf(' with Xdebug %s', phpversion('xdebug'));
}
$this->writeMessage('Runtime', $runtime);
if (isset($arguments['configuration'])) {
$this->writeMessage('Configuration', $arguments['configuration']->getFilename());
}
}
if (isset($arguments['deprecatedCheckForUnintentionallyCoveredCodeSettingUsed'])) {
print "Warning: Deprecated configuration setting \"checkForUnintentionallyCoveredCode\" used\n";
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
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']));
}
//.........这里部分代码省略.........
示例15: 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) {
//.........这里部分代码省略.........