本文整理汇总了PHP中PHP_CodeCoverage_Report_HTML::process方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Report_HTML::process方法的具体用法?PHP PHP_CodeCoverage_Report_HTML::process怎么用?PHP PHP_CodeCoverage_Report_HTML::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage_Report_HTML
的用法示例。
在下文中一共展示了PHP_CodeCoverage_Report_HTML::process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Process coverage
*
* @param string $name
*/
public function process($name)
{
$directory = __DIR__ . '/../build/coverage/behat/';
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
}
$this->writer->process($this->coverage, $directory . $name . '.cov');
}
示例2: stop
/**
* Stop to analysis the code coverage of the current request
* If STOP_COVERAGE_ANALISYS is set in GET parameters, build the code coverage report
* @global PHP_CodeCoverage $coverage
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
function stop()
{
global $coverage;
if (!isset($_GET["STOP_COVERAGE_ANALISYS"])) {
$coverage->stop();
$s = serialize($coverage);
$token = uniqid();
file_put_contents(FCPATH . 'local/temp/coverage/requests/' . $token, $s);
} else {
$files = glob(FCPATH . 'local/temp/coverage/requests/*');
foreach ($files as $file) {
$s = file_get_contents($file);
$data = unserialize($s);
$coverage->merge($data);
}
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, FCPATH . 'local/temp/coverage/code-coverage-report');
//Delete all files that were used to trace the requests
$files = glob(FCPATH . 'local/temp/coverage/requests/*');
foreach ($files as $file) {
if (is_file($file)) {
unlink($file);
}
}
}
}
示例3: run
public function run($input, $output = 'real-coverage-html')
{
$report = unserialize(file_get_contents($input));
$reader = new ParsingCoverageReader();
$classes = $reader->parseReport($report);
$mutator = new Mutator();
$testRunner = new PHPUnitRunner(new MultirunTestCommand(), array('tests', 'tests'));
$writer = new RealCoverageModifier($report);
$proxyFactory = new ProxyFactory($classes);
$autoloader = new ProxyAutoloader($proxyFactory);
$autoloader->register();
$classCounter = 0;
/** @var ClassMetadata $class */
foreach ($classes as $class) {
if (!$class->isCovered()) {
continue;
}
echo "\n" . (int) (++$classCounter * 100 / count($classes)) . "%: Processing " . $class->getName() . "\n";
$this->calculateRealCoverage($class, $proxyFactory, $testRunner, $mutator);
$writer->write($class);
}
$autoloader->unregister();
echo "\n\nWriting coverage report to " . $output . "\n";
$htmlWriter = new \PHP_CodeCoverage_Report_HTML();
$htmlWriter->process($report, $output);
}
示例4: testForClassWithAnonymousFunction
/**
* @covers PHP_CodeCoverage_Report_HTML
*/
public function testForClassWithAnonymousFunction()
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction';
$report = new PHP_CodeCoverage_Report_HTML();
$report->process($this->getCoverageForClassWithAnonymousFunction(), self::$TEST_TMP_PATH);
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
示例5: aferRunTests
/**
* Overwrites aferRunTests. Creates coverage report and clover report
* if required.
*/
protected function aferRunTests()
{
if ($this->getCoverageStatus()) {
$coverage = $this->coverage;
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, ASSETS_PATH . '/code-coverage-report');
}
}
示例6: 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 '<h3>Code coverage analysis unavailable</h3><p>To enable code coverage, the xdebug php module must be installed and enabled.</p>';
return;
}
$writer = new \PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, FULL_PATH . '/test/runtime/coverage');
echo '<a href="runtime/coverage" target="_blank">Code coverage report</a>';
}
示例7: _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);
}
示例8: array
function it_should_output_html_report(\PHP_CodeCoverage $coverage, \PHP_CodeCoverage_Report_HTML $html, SuiteEvent $event, IO $io)
{
$reports = array('html' => $html);
$this->beConstructedWith($coverage, $reports);
$this->setOptions(array('format' => 'html', 'output' => array('html' => 'coverage')));
$io->isVerbose()->willReturn(false);
$this->setIO($io);
$io->writeln(Argument::any())->shouldNotBeCalled();
$html->process($coverage, 'coverage')->willReturn('report');
$this->afterSuite($event);
}
示例9: unlink
function __c3_build_html_report(PHP_CodeCoverage $codeCoverage, $path)
{
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($codeCoverage, $path . 'html');
if (file_exists($path . '.tar')) {
unlink($path . '.tar');
}
$phar = new PharData($path . '.tar');
$phar->setSignatureAlgorithm(Phar::SHA1);
$files = $phar->buildFromDirectory($path . 'html');
array_map('unlink', $files);
if (in_array('GZ', Phar::getSupportedCompression())) {
if (file_exists($path . '.tar.gz')) {
unlink($path . '.tar.gz');
}
$phar->compress(\Phar::GZ);
// close the file so that we can rename it
unset($phar);
unlink($path . '.tar');
rename($path . '.tar.gz', $path . '.tar');
}
return $path . '.tar';
}
示例10: printHtml
protected function printHtml()
{
$writer = new \PHP_CodeCoverage_Report_HTML($this->settings['low_limit'], $this->settings['high_limit'], sprintf(', <a href="http://codeception.com">Codeception</a> and <a href="http://phpunit.de/">PHPUnit %s</a>', \PHPUnit_Runner_Version::id()));
$writer->process(self::$coverage, $this->absolutePath($this->options['coverage-html']));
}
示例11: 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) {
//.........这里部分代码省略.........
示例12: writeCoverageHtml
/**
* This method generates a html coverage report.
*
* @param PHP_CodeCoverage $coverage The raw coverage data.
*
* @return void
*/
protected function writeCoverageHtml(PHP_CodeCoverage $coverage)
{
if ($this->coverageHtml) {
$this->writeLine('Writing change coverage report, this may take a moment.');
$this->writeLine();
$html = new PHP_CodeCoverage_Report_HTML('Coverage Report for files modified since ' . date('Y/m/d', $this->modifiedSince), 'UTF-8', false, false, 35, 70, ' post processed by PHP_ChangeCoverage');
$html->process($coverage, $this->coverageHtml);
}
}
示例13: _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);
}
}
示例14: getToken
echo 'Broken:', sizeof($brokenTests) . PHP_EOL;
if (isset($opt['v']) || isset($opt['verbose'])) {
foreach ($brokenTests as $caseOut => $test) {
file_put_contents($caseOut . '-got', $test);
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 {
示例15: 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";
//.........这里部分代码省略.........