当前位置: 首页>>代码示例>>PHP>>正文


PHP PHP_CodeCoverage_Filter类代码示例

本文整理汇总了PHP中PHP_CodeCoverage_Filter的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Filter类的具体用法?PHP PHP_CodeCoverage_Filter怎么用?PHP PHP_CodeCoverage_Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHP_CodeCoverage_Filter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
 }
开发者ID:brianium,项目名称:paratest,代码行数:30,代码来源:CoverageMergerTest.php

示例2: __construct

 /**
  * CodeCoverage constructor
  */
 public function __construct()
 {
     $filter = new \PHP_CodeCoverage_Filter();
     $filter->addDirectoryToWhitelist(__DIR__ . '/../app');
     $filter->addDirectoryToWhitelist(__DIR__ . '/../src');
     $this->coverage = new \PHP_CodeCoverage(null, $filter);
     $this->writer = new \PHP_CodeCoverage_Report_PHP();
 }
开发者ID:epfremmer,项目名称:PHP-Weekly-Issue39,代码行数:11,代码来源:CodeCoverage.php

示例3: setup

 /** @BeforeSuite */
 public static function setup()
 {
     if (!self::$coverage) {
         $filter = new \PHP_CodeCoverage_Filter();
         $filter->addDirectoryToBlacklist(__DIR__ . '/../../../vendor');
         $filter->addDirectoryToWhitelist(__DIR__ . '/../../../Bundle');
         self::$coverage = new \PHP_CodeCoverage(null, $filter);
     }
 }
开发者ID:victoire,项目名称:victoire,代码行数:10,代码来源:CoverageContext.php

示例4: __construct

 /**
  * JBZooPHPUnit_Coverage constructor.
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function __construct()
 {
     if (Env::hasXdebug() && isset($_REQUEST['jbzoo-phpunit'])) {
         $cmsType = $_REQUEST['jbzoo-phpunit-type'];
         $testName = $_REQUEST['jbzoo-phpunit-test'];
         $this->_covRoot = realpath(__DIR__ . '/../..');
         $this->_covDir = realpath($this->_covRoot . '/src');
         $this->_covHash = implode('_', [md5(serialize($_REQUEST)), mt_rand(0, 100000000)]);
         $this->_covResult = realpath($this->_covRoot . '/build/coverage_cov') . '/' . $cmsType . '-' . $testName . '.cov';
         $covFilter = new PHP_CodeCoverage_Filter();
         $covFilter->addDirectoryToWhitelist($this->_covDir);
         $this->_coverage = new PHP_CodeCoverage(null, $covFilter);
     }
 }
开发者ID:JBZoo,项目名称:CrossCMS,代码行数:18,代码来源:fake-index.php

示例5: __construct

 /**
  * CovCatcher constructor.
  * @param string $testName
  * @param array  $options
  * @throws Exception
  */
 public function __construct($testName = null, array $options = array())
 {
     if (!class_exists('\\JBZoo\\Data\\Data')) {
         throw new Exception('jbzoo/data required for CovCatcher');
     }
     if (!class_exists('\\JBZoo\\Utils\\Env')) {
         throw new Exception('jbzoo/utils required for CovCatcher');
     }
     $this->_initConfig($options);
     $this->_hash = $this->_getPrefix($testName) . '_' . md5(serialize($this->_config->getArrayCopy()) . '|' . $testName);
     if (Env::hasXdebug()) {
         $covFilter = new \PHP_CodeCoverage_Filter();
         $covFilter->addDirectoryToWhitelist($this->_config->get('src'));
         $this->_coverage = new \PHP_CodeCoverage(null, $covFilter);
     }
 }
开发者ID:jbzoo,项目名称:phpunit,代码行数:22,代码来源:CovCatcher.php

示例6: startTestSuite

 /**
  * Add Mockery files to PHPUnit's blacklist so they don't showup on coverage reports
  */
 public function startTestSuite(\PHPUnit_Framework_TestSuite $suite)
 {
     if (class_exists('\\PHP_CodeCoverage_Filter') && method_exists('\\PHP_CodeCoverage_Filter', 'getInstance')) {
         \PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(__DIR__ . '/../../../Mockery/', '.php', '', 'PHPUNIT');
         \PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__DIR__ . '/../../../Mockery.php', 'PHPUNIT');
     }
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:10,代码来源:TestListener.php

示例7: createTestResult

 /**
  * Create the test result and splice on our code coverage reports.
  *
  * @return PHPUnit_Framework_TestResult
  */
 protected function createTestResult()
 {
     $result = new PHPUnit_Framework_TestResult();
     $FixtureInjector = new FixtureInjector($this->_getFixtureManager(array()));
     $result->addListener($FixtureInjector);
     if (!empty($this->_params['codeCoverage'])) {
         if (method_exists($result, 'collectCodeCoverageInformation')) {
             $result->collectCodeCoverageInformation(true);
         }
         if (method_exists($result, 'setCodeCoverage')) {
             $Filter = new PHP_CodeCoverage_Filter();
             $Filter->addFileToBlacklist('systemlib.php');
             $result->setCodeCoverage(new PHP_CodeCoverage(null, $Filter));
         }
     }
     return $result;
 }
开发者ID:imsamurai,项目名称:cakephp-environment,代码行数:22,代码来源:CakeTestRunner.php

示例8: getCodeCoverageFilter

 /**
  * Get the code coverage filter instance we will use for tests.
  * When running PHPUnit 3.5, this will return the singleton instance.
  * When running PHPUnit 3.6, this will return the instance we hold internally;
  * this same instance will be passed to PHPUnit in AgaviTesting::dispatch().
  *
  * @return     PHP_CodeCoverage_Filter The code coverage filter for our tests.
  *
  * @author     David Zülke <david.zuelke@bitextender.com>
  * @since      1.0.7
  * @deprecated 1.1.0 Use AgaviPhpUnitCli
  */
 public static function getCodeCoverageFilter()
 {
     if (self::$codeCoverageFilter === null) {
         // PHP_CodeCoverage doesn't expose any version info, we'll have to check if there is a static getInstance method
         self::$codeCoverageFilter = method_exists('PHP_CodeCoverage_Filter', 'getInstance') ? PHP_CodeCoverage_Filter::getInstance() : new PHP_CodeCoverage_Filter();
     }
     return self::$codeCoverageFilter;
 }
开发者ID:horros,项目名称:agavi,代码行数:20,代码来源:AgaviTesting.class.php

示例9: init

 /** 
  * Initialise the wrapper class.
  */
 public function init()
 {
     require_once 'PHP/CodeCoverage.php';
     require_once 'PHP/CodeCoverage/Report/HTML.php';
     require_once 'PHPUnit/Autoload.php';
     require_once 'PHP/CodeCoverage/Filter.php';
     PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT');
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:11,代码来源:PhpUnitWrapper_3_5.php

示例10: setUp

 /**
  * Set up the test suite.
  *
  * @return void
  * @access protected
  */
 protected function setUp()
 {
     // Update the code coverage blacklist -- we don't want to analyze all the
     // test code or any external PEAR libraries that we include:
     PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist('/usr/share/php');
     PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist('/usr/local/lib');
     PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(dirname(__FILE__));
     // Clear out Smarty files to ensure testing begins with a clean slate:
     $this->_smartyCleanup();
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:16,代码来源:AllTests.php

示例11: phpunit_autoload

 function phpunit_autoload($class)
 {
     if (strpos($class, 'PHPUnit_') === 0) {
         $file = str_replace('_', '/', $class) . '.php';
         $file = PHPUnit_Util_Filesystem::fileExistsInIncludePath($file);
         if ($file) {
             require_once $file;
             PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist($file, 'PHPUNIT');
         }
     }
 }
开发者ID:rmehner,项目名称:phpunit,代码行数:11,代码来源:Autoload.php

示例12: setCodeCoverageIgnores

	protected function setCodeCoverageIgnores()
	{
		$codeCoverageFilter = PHP_CodeCoverage_Filter::getInstance();
		$codeCoverageFilter->addDirectoryToBlacklist(dirname(__FILE__));
		
		foreach($this->codeCoverageIgnoreDirectoryList as $oneDirectory)
		{
			$codeCoverageFilter->addDirectoryToBlacklist($oneDirectory);
		}
		
		$codeCoverageFilter->addFilesToBlackList($this->codeCoverageIgnoreFileList);
	}
开发者ID:ramielrowe,项目名称:Radford-Reservation-System,代码行数:12,代码来源:TestRunner.php

示例13: setWhiteAndBlacklists

 /**
  * Set white / black lists
  */
 public function setWhiteAndBlacklists()
 {
     if ($this->isPhpunitVersionGreaterOrEquals("3.6.0")) {
         $filter = new PHP_CodeCoverage_Filter();
         $filter->addDirectoryToBlacklist(PATH_TO_TEST_DIR);
         $filter->addDirectoryToBlacklist(PATH_TO_TINE_LIBRARY);
         $filter->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Setup');
         $filter->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Zend');
     } else {
         if ($this->isPhpunitVersionGreaterOrEquals("3.5.0")) {
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_TEST_DIR);
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_TINE_LIBRARY);
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Setup');
             PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_TO_REAL_DIR . '/Zend');
         } else {
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_TEST_DIR);
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_TINE_LIBRARY);
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_REAL_DIR . '/Setup');
             PHPUnit_Util_Filter::addDirectoryToFilter(PATH_TO_REAL_DIR . '/Zend');
         }
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:25,代码来源:TestServer.php

示例14: 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]);
 }
开发者ID:mmontagna,项目名称:paratest,代码行数:23,代码来源:CoverageMergerTest.php

示例15: init

 /**
  * Initializes the Spec library
  *
  * @static
  * @param bool $autoload    Unless it's false it will register a custom autoloader
  * @return bool
  */
 public static function init($autoload = true)
 {
     static $alreadyInitialized = false;
     if ($alreadyInitialized) {
         return false;
     }
     // Register auto loader
     if ($autoload) {
         self::autoload();
     }
     // Register stream wrapper for spec files
     $scheme = self::SCHEME;
     if (!in_array($scheme, stream_get_wrappers())) {
         // Get loaded extensions
         $extensions = array_merge(get_loaded_extensions(), get_loaded_extensions(true));
         // Check if the Suhosin patch is loaded
         if (in_array('suhosin', $extensions)) {
             $list = ini_get('suhosin.executor.include.whitelist');
             $list = explode(',', $list);
             $list = array_filter(array_map('trim', $list));
             if (!in_array($scheme, $list)) {
                 throw new \RuntimeException("The Suhosin patch has been detected but the custom '{$scheme}' scheme was not found as allowed. " . "Please review your php.ini settings to include '{$scheme}' in 'suhosin.executor.include.whitelist'.");
             }
         }
         stream_wrapper_register($scheme, __NAMESPACE__ . '\\Spec\\StreamWrapper');
     }
     // Black list Spec files for PHPUnit
     if (class_exists('\\PHP_CodeCoverage_Filter', false)) {
         $filter = \PHP_CodeCoverage_Filter::getInstance();
         $filter->addFileToBlacklist(__FILE__, 'PHPUNIT');
         $filter->addDirectoryToBlacklist(__DIR__ . DIRECTORY_SEPARATOR . 'Spec', '.php', '', 'PHPUNIT', FALSE);
         // Also add Hamcrest matcher library from the include path
         $paths = explode(PATH_SEPARATOR, get_include_path());
         foreach ($paths as $path) {
             if (is_file($path . DIRECTORY_SEPARATOR . 'Hamcrest/MatcherAssert.php')) {
                 $filter->addDirectoryToBlacklist($path . DIRECTORY_SEPARATOR . 'Hamcrest', '.php', '', 'PHPUNIT', FALSE);
                 break;
             }
         }
     }
     // include standard matchers and keywords
     include_once __DIR__ . '/Spec/keywords.php';
     include_once __DIR__ . '/Spec/matchers.php';
     // Setup suite stack
     self::$suites = new \SplStack();
     return true;
 }
开发者ID:rafeca,项目名称:Spec-PHP,代码行数:54,代码来源:Spec.php


注:本文中的PHP_CodeCoverage_Filter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。