本文整理汇总了PHP中PHP_CodeCoverage_Filter::addFilesToWhitelist方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Filter::addFilesToWhitelist方法的具体用法?PHP PHP_CodeCoverage_Filter::addFilesToWhitelist怎么用?PHP PHP_CodeCoverage_Filter::addFilesToWhitelist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage_Filter
的用法示例。
在下文中一共展示了PHP_CodeCoverage_Filter::addFilesToWhitelist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSimpleMergeLegacy
/**
* Test merge for code coverage library 3 version
*
* @requires function \PHP_CodeCoverage::merge
*/
public function testSimpleMergeLegacy()
{
$firstFile = PARATEST_ROOT . '/src/ParaTest/Logging/LogInterpreter.php';
$secondFile = PARATEST_ROOT . '/src/ParaTest/Logging/MetaProvider.php';
$filter = new \PHP_CodeCoverage_Filter();
$filter->addFilesToWhitelist([$firstFile, $secondFile]);
$coverage1 = new \PHP_CodeCoverage(null, $filter);
$coverage1->append(array($firstFile => array(35 => 1), $secondFile => array(34 => 1)), 'Test1');
$coverage2 = new \PHP_CodeCoverage(null, $filter);
$coverage2->append(array($firstFile => array(35 => 1, 36 => 1)), 'Test2');
$merger = new CoverageMerger();
$this->call($merger, 'addCoverage', $coverage1);
$this->call($merger, 'addCoverage', $coverage2);
/** @var \PHP_CodeCoverage $coverage */
$coverage = $this->getObjectValue($merger, 'coverage');
$this->assertInstanceOf('\\PHP_CodeCoverage', $coverage);
$data = $coverage->getData();
$this->assertCount(2, $data[$firstFile][35]);
$this->assertEquals('Test1', $data[$firstFile][35][0]);
$this->assertEquals('Test2', $data[$firstFile][35][1]);
$this->assertCount(1, $data[$firstFile][36]);
$this->assertEquals('Test2', $data[$firstFile][36][0]);
$this->assertCount(1, $data[$secondFile][34]);
$this->assertEquals('Test1', $data[$secondFile][34][0]);
}
示例2: testSimpleMerge
public function testSimpleMerge()
{
$firstFile = PARATEST_ROOT . '/src/ParaTest/Logging/LogInterpreter.php';
$secondFile = PARATEST_ROOT . '/src/ParaTest/Logging/MetaProvider.php';
$filter = new \PHP_CodeCoverage_Filter();
$filter->addFilesToWhitelist([$firstFile, $secondFile]);
$coverage1 = new \PHP_CodeCoverage(null, $filter);
$coverage1->append(array($firstFile => array(35 => 1), $secondFile => array(34 => 1)), 'Test1');
$coverage2 = new \PHP_CodeCoverage(null, $filter);
$coverage2->append(array($firstFile => array(35 => 1, 36 => 1)), 'Test2');
$merger = new CoverageMerger();
$merger->addCoverage($coverage1);
$merger->addCoverage($coverage2);
$coverage = $merger->getCoverage();
$data = $coverage->getData();
$this->assertEquals(2, count($data[$firstFile][35]));
$this->assertEquals('Test1', $data[$firstFile][35][0]);
$this->assertEquals('Test2', $data[$firstFile][35][1]);
$this->assertEquals(1, count($data[$firstFile][36]));
$this->assertEquals('Test2', $data[$firstFile][36][0]);
$this->assertEquals(1, count($data[$secondFile][34]));
$this->assertEquals('Test1', $data[$secondFile][34][0]);
}
示例3: createCodeCoverageFilter
/**
* Whitelists all kernel, lib and extension classes for code coverage
*
* @return PHP_CodeCoverage_Filter
*/
protected function createCodeCoverageFilter()
{
$filter = new PHP_CodeCoverage_Filter();
// Add kernel classes to whitelist
$kernelClassFiles = (require 'autoload/ezp_kernel.php');
$filter->addFilesToWhitelist($kernelClassFiles);
// Add extension classes to whitelist
if (!is_file('var/autoload/ezp_extension.php')) {
PHPUnit_TextUI_TestRunner::showError("Please generate the extension autoloads first.\n" . "You can generate them using php bin/php/ezpgenerateautoloads.php -e");
}
$extensionClassFiles = (require 'var/autoload/ezp_extension.php');
$filter->addFilesToWhitelist($extensionClassFiles);
return $filter;
}
示例4: addFilesToWhitelist
/**
* Add files to the whitelist.
*
* @param array $files
* @return $this
*/
public function addFilesToWhitelist(array $files)
{
$this->filter->addFilesToWhitelist($files);
return $this;
}
开发者ID:peridot-php,项目名称:peridot-code-coverage-reporters,代码行数:11,代码来源:AbstractCodeCoverageReporter.php