本文整理汇总了PHP中PHP_CodeCoverage::merge方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage::merge方法的具体用法?PHP PHP_CodeCoverage::merge怎么用?PHP PHP_CodeCoverage::merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage
的用法示例。
在下文中一共展示了PHP_CodeCoverage::merge方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCoverage
/**
* @param \PHP_CodeCoverage|CodeCoverage $coverage
*/
private function addCoverage($coverage)
{
if (null === $this->coverage) {
$this->coverage = $coverage;
} else {
$this->coverage->merge($coverage);
}
}
示例2: get_reports
public function get_reports()
{
$this->reports = get_transient('json_testhelper_coverage');
if (empty($this->reports)) {
return new WP_Error('json_testhelper_no_report', __('No report data available', 'json_testhelper'), array('status' => 400));
}
if (!class_exists('PHP_CodeCoverage')) {
return new WP_Error('json_testhelper_missing_codecoverage', __('The CodeCoverage classes are missing', 'json_testhelper'), array('status' => 500));
}
$master = new PHP_CodeCoverage();
foreach ($this->reports as $report) {
$master->merge($report);
}
// Clean up
delete_transient('json_testhelper_coverage');
$data = array('reports' => count($this->reports), 'data' => serialize($master));
return $data;
}
示例3: testMerge2
/**
* @covers PHP_CodeCoverage::getData
* @covers PHP_CodeCoverage::merge
*/
public function testMerge2()
{
$driver = $this->getMockBuilder('PHP_CodeCoverage_Driver')->setConstructorArgs(array(new PHP_CodeCoverage_Filter(), new PHP_CodeCoverage_Parser()))->getMockForAbstractClass();
$coverage = new PHP_CodeCoverage($driver, new PHP_CodeCoverage_Filter());
$coverage->merge($this->getCoverageForBankAccount());
$this->assertEquals($this->getExpectedDataArrayForBankAccount(), $coverage->getData());
}
示例4: testMerge
/**
* @covers PHP_CodeCoverage::merge
*/
public function testMerge()
{
$coverage = new PHP_CodeCoverage($this->setUpXdebugStubForBankAccount(), new PHP_CodeCoverage_Filter());
$coverage->merge($this->getCoverageForBankAccount());
$this->assertEquals($this->getCoverageForBankAccount()->getSummary(), $coverage->getSummary());
}
示例5: testMerge2
/**
* @covers PHP_CodeCoverage::getData
* @covers PHP_CodeCoverage::merge
*/
public function testMerge2()
{
$coverage = new PHP_CodeCoverage($this->getMock('PHP_CodeCoverage_Driver_Xdebug'), new PHP_CodeCoverage_Filter());
$coverage->merge($this->getCoverageForBankAccount());
$this->assertEquals($this->getExpectedDataArrayForBankAccount(), $coverage->getData());
}
示例6: 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('', '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('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;
$blacklist = $input->getOption('blacklist')->value;
$whitelist = $input->getOption('whitelist')->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 {
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();
$result = $facade->getFilesAsArray($arguments[0], '.cov');
foreach ($files as $file) {
$coverage->merge(unserialize(file_get_contents($file)));
}
}
if ($clover) {
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($coverage, $clover);
}
if ($html) {
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, $html);
}
} else {
self::showHelp();
exit(1);
}
}
示例7: mergeCoverage
/**
* @param \PHP_CodeCoverage $coverage
*/
private function mergeCoverage(\PHP_CodeCoverage $coverage)
{
$this->coverage->merge($coverage);
}
示例8: 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);
}
//.........这里部分代码省略.........