本文整理汇总了PHP中PHP_CodeCoverage_Filter::addDirectoryToBlacklist方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Filter::addDirectoryToBlacklist方法的具体用法?PHP PHP_CodeCoverage_Filter::addDirectoryToBlacklist怎么用?PHP PHP_CodeCoverage_Filter::addDirectoryToBlacklist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeCoverage_Filter
的用法示例。
在下文中一共展示了PHP_CodeCoverage_Filter::addDirectoryToBlacklist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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');
}
}
}
示例3: end
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
require $fileName;
});
}
/**
* Code coverage option
*/
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true) {
$codeCoverageFilter = new PHP_CodeCoverage_Filter();
$lastArg = end($_SERVER['argv']);
if (is_dir($zfCoreTests . '/' . $lastArg)) {
$codeCoverageFilter->addDirectoryToWhitelist($zfCoreLibrary . '/' . $lastArg);
} elseif (is_file($zfCoreTests . '/' . $lastArg)) {
$codeCoverageFilter->addDirectoryToWhitelist(dirname($zfCoreLibrary . '/' . $lastArg));
} else {
$codeCoverageFilter->addDirectoryToWhitelist($zfCoreLibrary);
}
/*
* Omit from code coverage reports the contents of the tests directory
*/
$codeCoverageFilter->addDirectoryToBlacklist($zfCoreTests, '');
$codeCoverageFilter->addDirectoryToBlacklist(PEAR_INSTALL_DIR, '');
$codeCoverageFilter->addDirectoryToBlacklist(PHP_LIBDIR, '');
unset($codeCoverageFilter);
}
/*
* Unset global variables that are no longer needed.
*/
unset($phpUnitVersion);
示例4: execute
/**
* @param $suite
*/
protected function execute($suite)
{
$runner = new PHPUnitTestRunner($this->project, $this->groups, $this->excludeGroups, $this->processIsolation);
if ($this->codecoverage) {
/**
* Add some defaults to the PHPUnit filter
*/
$pwd = dirname(__FILE__);
$path = realpath($pwd . '/../../../');
$filter = new PHP_CodeCoverage_Filter();
$filter->addDirectoryToBlacklist($path);
$runner->setCodecoverage(new PHP_CodeCoverage(null, $filter));
}
$runner->setUseCustomErrorHandler($this->usecustomerrorhandler);
foreach ($this->listeners as $listener) {
$runner->addListener($listener);
}
foreach ($this->formatters as $fe) {
$formatter = $fe->getFormatter();
if ($fe->getUseFile()) {
$destFile = new PhingFile($fe->getToDir(), $fe->getOutfile());
$writer = new FileWriter($destFile->getAbsolutePath());
$formatter->setOutput($writer);
} else {
$formatter->setOutput($this->getDefaultOutput());
}
$runner->addFormatter($formatter);
$formatter->startTestRun();
}
$runner->run($suite);
foreach ($this->formatters as $fe) {
$formatter = $fe->getFormatter();
$formatter->endTestRun();
}
if ($runner->hasErrors()) {
if ($this->errorproperty) {
$this->project->setNewProperty($this->errorproperty, true);
}
if ($this->haltonerror) {
$this->testfailed = true;
$this->testfailuremessage = $runner->getLastErrorMessage();
}
}
if ($runner->hasFailures()) {
if ($this->failureproperty) {
$this->project->setNewProperty($this->failureproperty, true);
}
if ($this->haltonfailure) {
$this->testfailed = true;
$this->testfailuremessage = $runner->getLastFailureMessage();
}
}
if ($runner->hasIncomplete()) {
if ($this->incompleteproperty) {
$this->project->setNewProperty($this->incompleteproperty, true);
}
if ($this->haltonincomplete) {
$this->testfailed = true;
$this->testfailuremessage = $runner->getLastIncompleteMessage();
}
}
if ($runner->hasSkipped()) {
if ($this->skippedproperty) {
$this->project->setNewProperty($this->skippedproperty, true);
}
if ($this->haltonskipped) {
$this->testfailed = true;
$this->testfailuremessage = $runner->getLastSkippedMessage();
}
}
}
示例5: handleConfiguration
//.........这里部分代码省略.........
$arguments['coverageTextShowOnlySummary'] = $loggingConfiguration['coverageTextShowOnlySummary'];
} else {
$arguments['coverageTextShowOnlySummary'] = false;
}
}
if (isset($loggingConfiguration['coverage-xml']) && !isset($arguments['coverageXml'])) {
$arguments['coverageXml'] = $loggingConfiguration['coverage-xml'];
}
if (isset($loggingConfiguration['json']) && !isset($arguments['jsonLogfile'])) {
$arguments['jsonLogfile'] = $loggingConfiguration['json'];
}
if (isset($loggingConfiguration['plain'])) {
$arguments['listeners'][] = new PHPUnit_TextUI_ResultPrinter($loggingConfiguration['plain'], true);
}
if (isset($loggingConfiguration['tap']) && !isset($arguments['tapLogfile'])) {
$arguments['tapLogfile'] = $loggingConfiguration['tap'];
}
if (isset($loggingConfiguration['junit']) && !isset($arguments['junitLogfile'])) {
$arguments['junitLogfile'] = $loggingConfiguration['junit'];
if (isset($loggingConfiguration['logIncompleteSkipped']) && !isset($arguments['logIncompleteSkipped'])) {
$arguments['logIncompleteSkipped'] = $loggingConfiguration['logIncompleteSkipped'];
}
}
if (isset($loggingConfiguration['testdox-html']) && !isset($arguments['testdoxHTMLFile'])) {
$arguments['testdoxHTMLFile'] = $loggingConfiguration['testdox-html'];
}
if (isset($loggingConfiguration['testdox-text']) && !isset($arguments['testdoxTextFile'])) {
$arguments['testdoxTextFile'] = $loggingConfiguration['testdox-text'];
}
if ((isset($arguments['coverageClover']) || isset($arguments['coverageCrap4J']) || isset($arguments['coverageHtml']) || isset($arguments['coveragePHP']) || isset($arguments['coverageText']) || isset($arguments['coverageXml'])) && $this->canCollectCodeCoverage) {
$filterConfiguration = $arguments['configuration']->getFilterConfiguration();
$arguments['addUncoveredFilesFromWhitelist'] = $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'];
$arguments['processUncoveredFilesFromWhitelist'] = $filterConfiguration['whitelist']['processUncoveredFilesFromWhitelist'];
if (empty($filterConfiguration['whitelist']['include']['directory']) && empty($filterConfiguration['whitelist']['include']['file'])) {
if (defined('__PHPUNIT_PHAR__')) {
$this->codeCoverageFilter->addFileToBlacklist(__PHPUNIT_PHAR__);
}
$blacklist = new PHPUnit_Util_Blacklist();
foreach ($blacklist->getBlacklistedDirectories() as $directory) {
$this->codeCoverageFilter->addDirectoryToBlacklist($directory);
}
foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
$this->codeCoverageFilter->addDirectoryToBlacklist($dir['path'], $dir['suffix'], $dir['prefix'], $dir['group']);
}
foreach ($filterConfiguration['blacklist']['include']['file'] as $file) {
$this->codeCoverageFilter->addFileToBlacklist($file);
}
foreach ($filterConfiguration['blacklist']['exclude']['directory'] as $dir) {
$this->codeCoverageFilter->removeDirectoryFromBlacklist($dir['path'], $dir['suffix'], $dir['prefix'], $dir['group']);
}
foreach ($filterConfiguration['blacklist']['exclude']['file'] as $file) {
$this->codeCoverageFilter->removeFileFromBlacklist($file);
}
}
foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
$this->codeCoverageFilter->addDirectoryToWhitelist($dir['path'], $dir['suffix'], $dir['prefix']);
}
foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
$this->codeCoverageFilter->addFileToWhitelist($file);
}
foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
$this->codeCoverageFilter->removeDirectoryFromWhitelist($dir['path'], $dir['suffix'], $dir['prefix']);
}
foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
$this->codeCoverageFilter->removeFileFromWhitelist($file);
}
}
}
$arguments['addUncoveredFilesFromWhitelist'] = isset($arguments['addUncoveredFilesFromWhitelist']) ? $arguments['addUncoveredFilesFromWhitelist'] : true;
$arguments['processUncoveredFilesFromWhitelist'] = isset($arguments['processUncoveredFilesFromWhitelist']) ? $arguments['processUncoveredFilesFromWhitelist'] : false;
$arguments['backupGlobals'] = isset($arguments['backupGlobals']) ? $arguments['backupGlobals'] : null;
$arguments['backupStaticAttributes'] = isset($arguments['backupStaticAttributes']) ? $arguments['backupStaticAttributes'] : null;
$arguments['cacheTokens'] = isset($arguments['cacheTokens']) ? $arguments['cacheTokens'] : false;
$arguments['columns'] = isset($arguments['columns']) ? $arguments['columns'] : 80;
$arguments['colors'] = isset($arguments['colors']) ? $arguments['colors'] : false;
$arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : true;
$arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : true;
$arguments['convertWarningsToExceptions'] = isset($arguments['convertWarningsToExceptions']) ? $arguments['convertWarningsToExceptions'] : true;
$arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
$arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
$arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : false;
$arguments['processIsolation'] = isset($arguments['processIsolation']) ? $arguments['processIsolation'] : false;
$arguments['repeat'] = isset($arguments['repeat']) ? $arguments['repeat'] : false;
$arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 90;
$arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 50;
$arguments['stopOnError'] = isset($arguments['stopOnError']) ? $arguments['stopOnError'] : false;
$arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : false;
$arguments['stopOnIncomplete'] = isset($arguments['stopOnIncomplete']) ? $arguments['stopOnIncomplete'] : false;
$arguments['stopOnRisky'] = isset($arguments['stopOnRisky']) ? $arguments['stopOnRisky'] : false;
$arguments['stopOnSkipped'] = isset($arguments['stopOnSkipped']) ? $arguments['stopOnSkipped'] : false;
$arguments['timeoutForSmallTests'] = isset($arguments['timeoutForSmallTests']) ? $arguments['timeoutForSmallTests'] : 1;
$arguments['timeoutForMediumTests'] = isset($arguments['timeoutForMediumTests']) ? $arguments['timeoutForMediumTests'] : 10;
$arguments['timeoutForLargeTests'] = isset($arguments['timeoutForLargeTests']) ? $arguments['timeoutForLargeTests'] : 60;
$arguments['reportUselessTests'] = isset($arguments['reportUselessTests']) ? $arguments['reportUselessTests'] : false;
$arguments['strictCoverage'] = isset($arguments['strictCoverage']) ? $arguments['strictCoverage'] : false;
$arguments['disallowTestOutput'] = isset($arguments['disallowTestOutput']) ? $arguments['disallowTestOutput'] : false;
$arguments['enforceTimeLimit'] = isset($arguments['enforceTimeLimit']) ? $arguments['enforceTimeLimit'] : false;
$arguments['disallowTodoAnnotatedTests'] = isset($arguments['disallowTodoAnnotatedTests']) ? $arguments['disallowTodoAnnotatedTests'] : false;
$arguments['verbose'] = isset($arguments['verbose']) ? $arguments['verbose'] : false;
}
示例6: handleConfiguration
//.........这里部分代码省略.........
}
$arguments['reportDirectory'] = $loggingConfiguration['coverage-html'];
}
if (isset($loggingConfiguration['coverage-clover']) && !isset($arguments['coverageClover'])) {
$arguments['coverageClover'] = $loggingConfiguration['coverage-clover'];
}
if (isset($loggingConfiguration['coverage-php']) && !isset($arguments['coveragePHP'])) {
$arguments['coveragePHP'] = $loggingConfiguration['coverage-php'];
}
if (isset($loggingConfiguration['coverage-text']) && !isset($arguments['coverageText'])) {
$arguments['coverageText'] = $loggingConfiguration['coverage-text'];
if (isset($loggingConfiguration['coverageTextShowUncoveredFiles'])) {
$arguments['coverageTextShowUncoveredFiles'] = $loggingConfiguration['coverageTextShowUncoveredFiles'];
} else {
$arguments['coverageTextShowUncoveredFiles'] = FALSE;
}
}
if (isset($loggingConfiguration['json']) && !isset($arguments['jsonLogfile'])) {
$arguments['jsonLogfile'] = $loggingConfiguration['json'];
}
if (isset($loggingConfiguration['plain'])) {
$arguments['listeners'][] = new PHPUnit_TextUI_ResultPrinter($loggingConfiguration['plain'], TRUE);
}
if (isset($loggingConfiguration['tap']) && !isset($arguments['tapLogfile'])) {
$arguments['tapLogfile'] = $loggingConfiguration['tap'];
}
if (isset($loggingConfiguration['junit']) && !isset($arguments['junitLogfile'])) {
$arguments['junitLogfile'] = $loggingConfiguration['junit'];
if (isset($loggingConfiguration['logIncompleteSkipped']) && !isset($arguments['logIncompleteSkipped'])) {
$arguments['logIncompleteSkipped'] = $loggingConfiguration['logIncompleteSkipped'];
}
}
if (isset($loggingConfiguration['testdox-html']) && !isset($arguments['testdoxHTMLFile'])) {
$arguments['testdoxHTMLFile'] = $loggingConfiguration['testdox-html'];
}
if (isset($loggingConfiguration['testdox-text']) && !isset($arguments['testdoxTextFile'])) {
$arguments['testdoxTextFile'] = $loggingConfiguration['testdox-text'];
}
if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory']) || isset($arguments['coveragePHP']) || isset($arguments['coverageText'])) && extension_loaded('xdebug')) {
$filterConfiguration = $arguments['configuration']->getFilterConfiguration();
$arguments['addUncoveredFilesFromWhitelist'] = $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'];
foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
$this->codeCoverageFilter->addDirectoryToBlacklist($dir['path'], $dir['suffix'], $dir['prefix'], $dir['group']);
}
foreach ($filterConfiguration['blacklist']['include']['file'] as $file) {
$this->codeCoverageFilter->addFileToBlacklist($file);
}
foreach ($filterConfiguration['blacklist']['exclude']['directory'] as $dir) {
$this->codeCoverageFilter->removeDirectoryFromBlacklist($dir['path'], $dir['suffix'], $dir['prefix'], $dir['group']);
}
foreach ($filterConfiguration['blacklist']['exclude']['file'] as $file) {
$this->codeCoverageFilter->removeFileFromBlacklist($file);
}
foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
$this->codeCoverageFilter->addDirectoryToWhitelist($dir['path'], $dir['suffix'], $dir['prefix']);
}
foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
$this->codeCoverageFilter->addFileToWhitelist($file);
}
foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
$this->codeCoverageFilter->removeDirectoryFromWhitelist($dir['path'], $dir['suffix'], $dir['prefix']);
}
foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
$this->codeCoverageFilter->removeFileFromWhitelist($file);
}
}
}
$arguments['addUncoveredFilesFromWhitelist'] = isset($arguments['addUncoveredFilesFromWhitelist']) ? $arguments['addUncoveredFilesFromWhitelist'] : TRUE;
$arguments['backupGlobals'] = isset($arguments['backupGlobals']) ? $arguments['backupGlobals'] : NULL;
$arguments['backupStaticAttributes'] = isset($arguments['backupStaticAttributes']) ? $arguments['backupStaticAttributes'] : NULL;
$arguments['cacheTokens'] = isset($arguments['cacheTokens']) ? $arguments['cacheTokens'] : TRUE;
$arguments['colors'] = isset($arguments['colors']) ? $arguments['colors'] : FALSE;
$arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : TRUE;
$arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : TRUE;
$arguments['convertWarningsToExceptions'] = isset($arguments['convertWarningsToExceptions']) ? $arguments['convertWarningsToExceptions'] : TRUE;
$arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
$arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
$arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : FALSE;
$arguments['processIsolation'] = isset($arguments['processIsolation']) ? $arguments['processIsolation'] : FALSE;
$arguments['repeat'] = isset($arguments['repeat']) ? $arguments['repeat'] : FALSE;
$arguments['reportCharset'] = isset($arguments['reportCharset']) ? $arguments['reportCharset'] : 'UTF-8';
$arguments['reportHighlight'] = isset($arguments['reportHighlight']) ? $arguments['reportHighlight'] : FALSE;
$arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 70;
$arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 35;
$arguments['reportYUI'] = isset($arguments['reportYUI']) ? $arguments['reportYUI'] : TRUE;
$arguments['stopOnError'] = isset($arguments['stopOnError']) ? $arguments['stopOnError'] : FALSE;
$arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : FALSE;
$arguments['stopOnIncomplete'] = isset($arguments['stopOnIncomplete']) ? $arguments['stopOnIncomplete'] : FALSE;
$arguments['stopOnSkipped'] = isset($arguments['stopOnSkipped']) ? $arguments['stopOnSkipped'] : FALSE;
$arguments['timeoutForSmallTests'] = isset($arguments['timeoutForSmallTests']) ? $arguments['timeoutForSmallTests'] : 1;
$arguments['timeoutForMediumTests'] = isset($arguments['timeoutForMediumTests']) ? $arguments['timeoutForMediumTests'] : 10;
$arguments['timeoutForLargeTests'] = isset($arguments['timeoutForLargeTests']) ? $arguments['timeoutForLargeTests'] : 60;
$arguments['strict'] = isset($arguments['strict']) ? $arguments['strict'] : FALSE;
$arguments['verbose'] = isset($arguments['verbose']) ? $arguments['verbose'] : FALSE;
if ($arguments['filter'] !== FALSE && preg_match('/^[a-zA-Z0-9_]/', $arguments['filter'])) {
// Escape delimiters in regular expression. Do NOT use preg_quote,
// to keep magic characters.
$arguments['filter'] = '/' . str_replace('/', '\\/', $arguments['filter']) . '/';
}
}
示例7: addDirectoryToBlacklist
/**
* Add a directory to the blacklist (recursively).
*
* @param string $directory
* @param string $suffix
* @param string $prefix
* @return $this
*/
public function addDirectoryToBlacklist($directory, $suffix = '.php', $prefix = '')
{
$this->filter->addDirectoryToBlacklist($directory, $suffix, $prefix);
return $this;
}
开发者ID:peridot-php,项目名称:peridot-code-coverage-reporters,代码行数:13,代码来源:AbstractCodeCoverageReporter.php
示例8: realpath
<?php
use JoeFallon\KissTest\UnitTest;
require 'config/main.php';
/****************************************************************************
* Code Coverage Start
****************************************************************************/
$filter = new PHP_CodeCoverage_Filter();
$filter->addDirectoryToBlacklist(realpath('./'));
$filter->addDirectoryToBlacklist(realpath('../vendor'));
$coverage = new PHP_CodeCoverage(null, $filter);
$coverage->start('All Tests');
/****************************************************************************
* Unit Tests
****************************************************************************/
new \tests\JoeFallon\PhpTime\ChronographTests();
new \tests\JoeFallon\PhpTime\DaysTests();
new \tests\JoeFallon\PhpTime\MonthsTests();
new \tests\JoeFallon\PhpTime\MySqlDateTimeTests();
UnitTest::getAllUnitTestsSummary();
/****************************************************************************
* Code Coverage Stop
****************************************************************************/
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_HTML();
$writer->process($coverage, realpath('../cov'));
示例9: explode
* @todo put that in config.inc as well or remove that?
*/
define('CONFIGURATION', PATH_TO_TEST_DIR . "/conf.xml");
/*
* Set up basic tine 2.0 environment
*/
require_once 'bootstrap.php';
// add test paths to autoloader
$autoloader = (require 'vendor/autoload.php');
$autoloader->set('', $path);
/*
* Set white / black lists
*/
$phpUnitVersion = explode(' ', PHPUnit_Runner_Version::getVersionString());
if (version_compare($phpUnitVersion[1], "3.6.0") >= 0) {
$filter = new PHP_CodeCoverage_Filter();
$filter->addDirectoryToBlacklist(dirname(__FILE__));
} else {
if (version_compare($phpUnitVersion[1], "3.5.0") >= 0) {
PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(dirname(__FILE__));
} else {
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
}
}
// get config
$configData = (include 'phpunitconfig.inc.php');
$config = new Zend_Config($configData);
$_SERVER['DOCUMENT_ROOT'] = $config->docroot;
Setup_TestServer::getInstance()->initFramework();
Tinebase_Core::set('locale', new Zend_Locale($config->locale));
Tinebase_Core::set('testconfig', $config);
示例10: dirname
* @todo put that in config.inc as well?
*/
error_reporting(E_ALL | E_STRICT);
/*
* Set include path
*/
define('PATH_TO_REAL_DIR', dirname(__FILE__) . '/../../tine20');
define('PATH_TO_TINE_LIBRARY', dirname(__FILE__) . '/../../tine20/library');
define('PATH_TO_TEST_DIR', dirname(__FILE__));
/*
* Set white / black lists
*/
$phpUnitVersion = explode(' ', PHPUnit_Runner_Version::getVersionString());
if (version_compare($phpUnitVersion[1], "3.6.0") >= 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 (version_compare($phpUnitVersion[1], "3.5.0") >= 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');
}
示例11: getCodeCoverage
public static function getCodeCoverage($enableCoverage = false)
{
if ($enableCoverage && class_exists('PHP_CodeCoverage')) {
$filter = new PHP_CodeCoverage_Filter();
$filter->addDirectoryToBlacklist($GLOBALS['codendi_dir'] . '/tools');
$filter->addDirectoryToBlacklist($GLOBALS['codendi_dir'] . '/tools', '.inc');
$filter->addDirectoryToBlacklist($GLOBALS['codendi_dir'] . '/tools', '.txt');
$filter->addDirectoryToBlacklist($GLOBALS['codendi_dir'] . '/tools', '.dist');
$filter->addDirectoryToBlacklist($GLOBALS['htmlpurifier_dir']);
$filter->addDirectoryToBlacklist($GLOBALS['jpgraph_dir']);
$filter->addDirectoryToBlacklist($GLOBALS['codendi_dir'] . '/src/www');
return new PHP_CodeCoverage(null, $filter);
}
return null;
}
示例12: dirname
<?php
/**
* Flitch
*
* @link http://github.com/DASPRiD/Flitch For the canonical source repository
* @copyright 2011-2012 Ben Scholzen 'DASPRiD'
* @license http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
*/
// Set error reporting pretty high
error_reporting(E_ALL | E_STRICT);
// Get base, application and tests path
define('BASE_PATH', dirname(__DIR__));
define('TESTS_PATH', __DIR__);
// Define filters for clover report
$filter = new PHP_CodeCoverage_Filter();
$filter->addDirectoryToBlacklist(TESTS_PATH);
$filter->addDirectoryToBlacklist(BASE_PATH . '/bin');
$filter->addFilesToBlacklist(array(BASE_PATH . '/src/autoload_classmap.php', BASE_PATH . '/src/autoload_function.php', BASE_PATH . '/src/autoload_register.php'));
$filter->addDirectoryToWhitelist(BASE_PATH . '/src', '.php');
unset($filter);
// Load autoloader
require_once BASE_PATH . '/src/autoload_register.php';
示例13: sprintf
require 'vendor/symfony/yaml/Yaml.php';
require 'vendor/phpunit/php-text-template/src/Template.php';
require 'vendor/phpunit/php-token-stream/src/Token.php';
require 'vendor/phpunit/php-code-coverage/src/CodeCoverage/Driver.php';
require 'vendor/phpunit/php-code-coverage/src/CodeCoverage/Driver/Xdebug.php';
require 'vendor/sebastian/environment/src/Runtime.php';
require 'vendor/phpunit/php-code-coverage/src/CodeCoverage.php';
require 'vendor/phpunit/php-file-iterator/src/Iterator.php';
require 'vendor/phpunit/php-file-iterator/src/Factory.php';
require 'vendor/phpunit/php-file-iterator/src/Facade.php';
require 'vendor/phpunit/php-code-coverage/src/CodeCoverage/Filter.php';
$filter = new PHP_CodeCoverage_Filter();
$filter->addFileToBlacklist('fmt.php');
$filter->addFileToBlacklist('fmt.src.php');
$filter->addFileToBlacklist('test.php');
$filter->addDirectoryToBlacklist('vendor');
$coverage = new PHP_CodeCoverage(null, $filter);
}
$testNumber = '';
if (isset($opt['testNumber'])) {
if (is_numeric($opt['testNumber'])) {
$testNumber = sprintf('%03d', (int) $opt['testNumber']);
} else {
$testNumber = sprintf('%s', $opt['testNumber']);
}
}
$bogomips = null;
if (isset($opt['baseline'])) {
echo 'Calculating baseline... ';
$bogomips = bogomips();
echo 'done', PHP_EOL;
示例14: start
* (at your option) any later version.
*
* Jorani is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jorani. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright (c) 2014 - 2015 Benjamin BALET
*/
require_once APPPATH . "/third_party/phpcov/vendor/autoload.php";
global $coverage;
$filter = new PHP_CodeCoverage_Filter();
$filter->addDirectoryToBlacklist(SYSDIR);
$filter->addDirectoryToBlacklist(APPPATH . 'config');
$filter->addDirectoryToBlacklist(APPPATH . 'core');
$filter->addDirectoryToBlacklist(APPPATH . 'hooks');
$filter->addDirectoryToBlacklist(APPPATH . 'language');
$filter->addDirectoryToBlacklist(APPPATH . 'third_party');
$filter->addDirectoryToBlacklist(FCPATH . 'local');
$coverage = new PHP_CodeCoverage(null, $filter);
/**
* Start to analysis the code coverage of the current request
* @global PHP_CodeCoverage $coverage
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
function start()
{
if (!isset($_GET["STOP_COVERAGE_ANALISYS"])) {
示例15: getCodeCoverageFilter
/**
* @return PHP_CodeCoverage_Filter
*/
private function getCodeCoverageFilter()
{
$filter = new PHP_CodeCoverage_Filter();
if (defined('__PHPUNIT_PHAR__')) {
$filter->addFileToBlacklist(__PHPUNIT_PHAR__);
}
$blacklist = new PHPUnit_Util_Blacklist();
foreach ($blacklist->getBlacklistedDirectories() as $directory) {
$filter->addDirectoryToBlacklist($directory);
}
return $filter;
}