本文整理汇总了PHP中PHPUnit_Util_Filter::addFileToFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Filter::addFileToFilter方法的具体用法?PHP PHPUnit_Util_Filter::addFileToFilter怎么用?PHP PHPUnit_Util_Filter::addFileToFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Filter
的用法示例。
在下文中一共展示了PHPUnit_Util_Filter::addFileToFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: suite
public static function suite()
{
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
$suite = new PHPUnit_Framework_TestSuite('Joeh Framework');
$suite->addTestSuite('Joeh_Net_CurlTest');
$suite->addTestSuite('Joeh_Net_Curl_OptionTest');
return $suite;
}
示例2: __construct
public function __construct($name, $directory)
{
$this->name = $name;
$files = Kohana::list_files($directory);
foreach ($files as $file) {
if (!is_file($file)) {
continue;
}
if (substr_compare($file, 'Base_Test' . EXT, strlen($file) - strlen('Base_Test' . EXT)) !== 0) {
PHPUnit_Util_Filter::addFileToFilter($file);
$this->addTestFile($file);
}
}
}
示例3: suite
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('Adamantium Test Suite');
$directories = getTestDirectories();
foreach ($directories as $directory) {
foreach (glob($directory . '*.test.php') as $file) {
$class = preg_replace('/(.*)\\.test\\.php/', '\\1', basename($file));
require_once $file;
$suite->addTestSuite($class . 'Test');
}
}
PHPUnit_Util_Filter::addFileToFilter('test.php');
PHPUnit_Util_Filter::addFileToFilter('settings.php');
return $suite;
}
示例4: addTests
public static function addTests($suite, $files)
{
foreach ($files as $file) {
if (is_array($file)) {
self::addTests($suite, $file);
} else {
if (is_file($file)) {
// The default PHPUnit TestCase extension
if (!strpos($file, 'TestCase' . EXT)) {
$suite->addTestFile($file);
} else {
require_once $file;
}
PHPUnit_Util_Filter::addFileToFilter($file);
}
}
}
}
示例5: init
/**
* Initialize Task.
* This method includes any necessary PHPUnit2 libraries and triggers
* appropriate error if they cannot be found. This is not done in header
* because we may want this class to be loaded w/o triggering an error.
*/
function init()
{
if (version_compare(PHP_VERSION, '5.0.3') < 0) {
throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
}
/**
* Determine PHPUnit version number
*/
@(include_once 'PHPUnit/Runner/Version.php');
@(include_once 'PHPUnit2/Runner/Version.php');
if (class_exists('PHPUnit_Runner_Version')) {
$version = PHPUnit_Runner_Version::id();
} elseif (class_exists('PHPUnit2_Runner_Version')) {
$version = PHPUnit2_Runner_Version::id();
} else {
throw new BuildException("PHPUnit task depends on PHPUnit 2 or 3 package being installed.", $this->getLocation());
}
if (version_compare($version, "3.0.0") >= 0) {
PHPUnitUtil::$installedVersion = 3;
if (version_compare($version, "3.2.0") >= 0) {
PHPUnitUtil::$installedMinorVersion = 2;
}
} else {
PHPUnitUtil::$installedVersion = 2;
}
/**
* Other dependencies that should only be loaded when class is actually used.
*/
require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
require_once 'phing/tasks/ext/phpunit/BatchTest.php';
require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
/**
* Add some defaults to the PHPUnit filter
*/
$pwd = dirname(__FILE__);
if (PHPUnitUtil::$installedVersion == 3) {
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Util/Filter.php';
// point PHPUnit_MAIN_METHOD define to non-existing method
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
}
PHPUnit_Util_Filter::addFileToFilter($pwd . '/PHPUnitTask.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/PHPUnitTestRunner.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Task.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Target.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Project.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Phing.php', 'PHING');
} else {
require_once 'PHPUnit2/Framework.php';
require_once 'PHPUnit2/Util/Filter.php';
PHPUnit2_Util_Filter::addFileToFilter($pwd . '/PHPUnitTask.php');
PHPUnit2_Util_Filter::addFileToFilter($pwd . '/PHPUnitTestRunner.php');
PHPUnit2_Util_Filter::addFileToFilter($pwd . '/../../../Task.php');
PHPUnit2_Util_Filter::addFileToFilter($pwd . '/../../../Target.php');
PHPUnit2_Util_Filter::addFileToFilter($pwd . '/../../../Project.php');
PHPUnit2_Util_Filter::addFileToFilter($pwd . '/../../../Phing.php');
}
}
示例6: addTests
/**
* Add files to test suite $suite
*
* Uses recursion to scan subdirectories
*
* @param PHPUnit_Framework_TestSuite $suite The test suite to add to
* @param array $files Array of files to test
*/
static function addTests(PHPUnit_Framework_TestSuite $suite, array $files)
{
foreach ($files as $file) {
if (is_array($file)) {
self::addTests($suite, $file);
} else {
// Make sure we only include php files
if (is_file($file) and substr($file, -strlen(EXT)) === EXT) {
// The default PHPUnit TestCase extension
if (!strpos($file, 'TestCase' . EXT)) {
$suite->addTestFile($file);
} else {
require_once $file;
}
PHPUnit_Util_Filter::addFileToFilter($file);
}
}
}
}
示例7: suite
*/
require_once 'formatting_properties.php';
require_once 'formatting_property_collection.php';
require_once 'paragraph_property_generator_test.php';
require_once 'text_property_generator_test.php';
require_once 'style.php';
require_once 'style_converters.php';
require_once 'text_processor_test.php';
require_once 'list_level_style_test.php';
require_once 'style_parser_test.php';
require_once 'style_extractor_test.php';
require_once 'meta_generator_test.php';
/**
* This file is not in use, yet, therefore not tested.
*/
PHPUnit_Util_Filter::addFileToFilter(dirname(__FILE__) . '/../../src/document/xml/odt/filter/element/html_table.php');
class ezcDocumentOdtSuite extends PHPUnit_Framework_TestSuite
{
public static function suite()
{
return new ezcDocumentOdtSuite();
}
public function __construct()
{
parent::__construct();
$this->setName("Document ODT tests");
$this->addTest(ezcDocumentOdtFormattingPropertiesTest::suite());
$this->addTest(ezcDocumentOdtFormattingPropertyCollectionTest::suite());
$this->addTest(ezcDocumentOdtStyleParagraphPropertyGeneratorTest::suite());
$this->addTest(ezcDocumentOdtStyleTextPropertyGeneratorTest::suite());
$this->addTest(ezcDocumentOdtStyleTest::suite());
示例8: collectEndAndAddToBlacklist
/**
* Stops the collection of loaded files and adds
* the names of the loaded files to the blacklist.
*
* @return array
* @since Method available since Release 3.4.6
*/
public static function collectEndAndAddToBlacklist()
{
foreach (self::collectEnd() as $blacklistedFile) {
PHPUnit_Util_Filter::addFileToFilter($blacklistedFile, 'PHPUNIT');
}
}
示例9: init
/**
* Initialize Task.
* This method includes any necessary PHPUnit2 libraries and triggers
* appropriate error if they cannot be found. This is not done in header
* because we may want this class to be loaded w/o triggering an error.
*/
function init()
{
if (version_compare(PHP_VERSION, '5.0.3') < 0) {
throw new BuildException("PHPUnitTask requires PHP version >= 5.0.3", $this->getLocation());
}
/**
* Determine PHPUnit version number
*/
@(include_once 'PHPUnit/Runner/Version.php');
$version = PHPUnit_Runner_Version::id();
if (version_compare($version, '3.2.0') < 0) {
throw new BuildException("PHPUnitTask requires PHPUnit version >= 3.2.0", $this->getLocation());
}
/**
* Other dependencies that should only be loaded when class is actually used.
*/
require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
require_once 'phing/tasks/ext/phpunit/BatchTest.php';
require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
/**
* Add some defaults to the PHPUnit filter
*/
$pwd = dirname(__FILE__);
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Util/Filter.php';
// point PHPUnit_MAIN_METHOD define to non-existing method
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
}
PHPUnit_Util_Filter::addFileToFilter($pwd . '/PHPUnitTask.php');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/PHPUnitTestRunner.php');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Task.php');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Target.php');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Project.php');
PHPUnit_Util_Filter::addFileToFilter($pwd . '/../../../Phing.php');
}
示例10: init
/**
* Initialize Task.
* This method includes any necessary PHPUnit2 libraries and triggers
* appropriate error if they cannot be found. This is not done in header
* because we may want this class to be loaded w/o triggering an error.
*/
function init()
{
if (version_compare(PHP_VERSION, '5.0.3') < 0) {
throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
}
/**
* Ugly hack to get PHPUnit version number
*/
$config = new PEAR_Config();
$registry = new PEAR_Registry($config->get('php_dir'));
$pkg_info = $registry->_packageInfo("PHPUnit", null, "pear.phpunit.de");
if ($pkg_info != NULL) {
if (version_compare($pkg_info['version']['api'], "3.0.0") >= 0) {
PHPUnitUtil::$installedVersion = 3;
} else {
PHPUnitUtil::$installedVersion = 2;
}
} else {
/**
* Try to find PHPUnit2
*/
require_once 'PHPUnit2/Util/Filter.php';
if (!class_exists('PHPUnit2_Util_Filter')) {
throw new BuildException("PHPUnit2Task depends on PEAR PHPUnit2 package being installed.", $this->getLocation());
}
PHPUnitUtil::$installedVersion = 2;
}
// other dependencies that should only be loaded when class is actually used.
require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
require_once 'phing/tasks/ext/phpunit/BatchTest.php';
require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
//require_once 'phing/tasks/ext/phpunit/SummaryPHPUnit2ResultFormatter.php';
// add some defaults to the PHPUnit filter
if (PHPUnitUtil::$installedVersion == 3) {
require_once 'PHPUnit/Util/Filter.php';
// point PHPUnit_MAIN_METHOD define to non-existing method
define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
} else {
require_once 'PHPUnit2/Util/Filter.php';
PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
PHPUnit2_Util_Filter::addFileToFilter('phing.php');
}
}
示例11: __construct
/**
* @param string $type The type of concrete Log subclass to use.
* Currently, valid values are 'console',
* 'syslog', 'sql', 'file', and 'mcal'.
* @param string $name The name of the actually log file, table, or
* other specific store to use. Defaults to an
* empty string, with which the subclass will
* attempt to do something intelligent.
* @param string $ident The identity reported to the log system.
* @param array $conf A hash containing any additional configuration
* information that a subclass might need.
* @param int $maxLevel Maximum priority level at which to log.
*/
public function __construct($type, $name = '', $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
{
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Log.php')) {
PHPUnit_Util_Filesystem::collectStart();
require_once 'Log.php';
$this->log = Log::factory($type, $name, $ident, $conf, $maxLevel);
foreach (PHPUnit_Util_Filesystem::collectEnd() as $blacklistedFile) {
PHPUnit_Util_Filter::addFileToFilter($blacklistedFile, 'PHPUNIT');
}
} else {
throw new RuntimeException('Log is not available.');
}
}
示例12: dirname
*
* @category Zend
* @package Zend_Ldap
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: AllTests.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* Test helper
*/
require_once dirname(__FILE__) . '/../../TestHelper.php';
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Zend_Ldap_AllTests::main');
}
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
/**
* @see Zend_Ldap_OfflineTest
*/
require_once 'Zend/Ldap/OfflineTest.php';
/**
* @category Zend
* @package Zend_Ldap
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Ldap_AllTests
{
public static function main()
{
示例13: handleConfiguration
/**
* @param array $arguments
* @since Method available since Release 3.2.1
*/
protected function handleConfiguration(array &$arguments)
{
if (isset($arguments['configuration'])) {
$arguments['configuration'] = new PHPUnit_Util_Configuration($arguments['configuration']);
$arguments['pmd'] = $arguments['configuration']->getPMDConfiguration();
} else {
$arguments['pmd'] = array();
}
$arguments['filter'] = isset($arguments['filter']) ? $arguments['filter'] : FALSE;
$arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
$arguments['repeat'] = isset($arguments['repeat']) ? $arguments['repeat'] : FALSE;
$arguments['testDatabasePrefix'] = isset($arguments['testDatabasePrefix']) ? $arguments['testDatabasePrefix'] : '';
$arguments['verbose'] = isset($arguments['verbose']) ? $arguments['verbose'] : FALSE;
$arguments['wait'] = isset($arguments['wait']) ? $arguments['wait'] : FALSE;
if (isset($arguments['configuration'])) {
$arguments['configuration']->handlePHPConfiguration();
$filterConfiguration = $arguments['configuration']->getFilterConfiguration();
PHPUnit_Util_Filter::$addUncoveredFilesFromWhitelist = $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'];
foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
PHPUnit_Util_Filter::addDirectoryToFilter($dir['path'], $dir['suffix']);
}
foreach ($filterConfiguration['blacklist']['include']['file'] as $file) {
PHPUnit_Util_Filter::addFileToFilter($file);
}
foreach ($filterConfiguration['blacklist']['exclude']['directory'] as $dir) {
PHPUnit_Util_Filter::removeDirectoryFromFilter($dir['path'], $dir['suffix']);
}
foreach ($filterConfiguration['blacklist']['exclude']['file'] as $file) {
PHPUnit_Util_Filter::removeFileFromFilter($file);
}
foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
PHPUnit_Util_Filter::addDirectoryToWhitelist($dir['path'], $dir['suffix']);
}
foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
PHPUnit_Util_Filter::addFileToWhitelist($file);
}
foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
PHPUnit_Util_Filter::removeDirectoryFromWhitelist($dir['path'], $dir['suffix']);
}
foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
PHPUnit_Util_Filter::removeFileFromWhitelist($file);
}
$phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration();
if (isset($phpunitConfiguration['ansi']) && !isset($arguments['ansi'])) {
$arguments['ansi'] = $phpunitConfiguration['ansi'];
}
if (isset($phpunitConfiguration['convertErrorsToExceptions']) && !isset($arguments['convertErrorsToExceptions'])) {
$arguments['convertErrorsToExceptions'] = $phpunitConfiguration['convertErrorsToExceptions'];
}
if (isset($phpunitConfiguration['convertNoticesToExceptions']) && !isset($arguments['convertNoticesToExceptions'])) {
$arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions'];
}
if (isset($phpunitConfiguration['convertWarningsToExceptions']) && !isset($arguments['convertWarningsToExceptions'])) {
$arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions'];
}
if (isset($phpunitConfiguration['stopOnFailure']) && !isset($arguments['stopOnFailure'])) {
$arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure'];
}
$groupConfiguration = $arguments['configuration']->getGroupConfiguration();
if (!empty($groupConfiguration['include']) && !isset($arguments['groups'])) {
$arguments['groups'] = $groupConfiguration['include'];
}
if (!empty($groupConfiguration['exclude']) && !isset($arguments['excludeGroups'])) {
$arguments['excludeGroups'] = $groupConfiguration['exclude'];
}
$loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
if (isset($loggingConfiguration['coverage-html']) && !isset($arguments['reportDirectory'])) {
if (isset($loggingConfiguration['charset']) && !isset($arguments['reportCharset'])) {
$arguments['reportCharset'] = $loggingConfiguration['charset'];
}
if (isset($loggingConfiguration['yui']) && !isset($arguments['reportYUI'])) {
$arguments['reportYUI'] = $loggingConfiguration['yui'];
}
if (isset($loggingConfiguration['highlight']) && !isset($arguments['reportHighlight'])) {
$arguments['reportHighlight'] = $loggingConfiguration['highlight'];
}
if (isset($loggingConfiguration['lowUpperBound']) && !isset($arguments['reportLowUpperBound'])) {
$arguments['reportLowUpperBound'] = $loggingConfiguration['lowUpperBound'];
}
if (isset($loggingConfiguration['highLowerBound']) && !isset($arguments['reportHighLowerBound'])) {
$arguments['reportHighLowerBound'] = $loggingConfiguration['highLowerBound'];
}
$arguments['reportDirectory'] = $loggingConfiguration['coverage-html'];
}
if (isset($loggingConfiguration['coverage-clover']) && !isset($arguments['coverageClover'])) {
$arguments['coverageClover'] = $loggingConfiguration['coverage-clover'];
}
if (isset($loggingConfiguration['coverage-xml']) && !isset($arguments['coverageClover'])) {
$arguments['coverageClover'] = $loggingConfiguration['coverage-xml'];
}
if (isset($loggingConfiguration['coverage-source']) && !isset($arguments['coverageSource'])) {
$arguments['coverageSource'] = $loggingConfiguration['coverage-source'];
}
if (isset($loggingConfiguration['graphviz']) && !isset($arguments['graphvizLogfile'])) {
$arguments['graphvizLogfile'] = $loggingConfiguration['graphviz'];
}
//.........这里部分代码省略.........
示例14: __construct
/**
* Constructor.
*
* @param mixed $out
*/
public function __construct($out = NULL)
{
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
PHPUnit_Util_Filesystem::collectStart();
require_once 'Image/GraphViz.php';
$this->graph = new Image_GraphViz(TRUE, array('overlap' => 'scale', 'splines' => 'true', 'sep' => '.1', 'fontsize' => '8'));
parent::__construct($out);
foreach (PHPUnit_Util_Filesystem::collectEnd() as $blacklistedFile) {
PHPUnit_Util_Filter::addFileToFilter($blacklistedFile, 'PHPUNIT');
}
} else {
throw new RuntimeException('Image_GraphViz is not available.');
}
}
示例15: blacklist
/**
* Blacklist a set of files in PHPUnit code coverage
*
* @param array $blacklist_items A set of files to blacklist
* @param Unittest_TestSuite $suite The test suite
*/
public static function blacklist(array $blacklist_items, Unittest_TestSuite $suite = NULL)
{
if (self::$phpunit_v35) {
foreach ($blacklist_items as $item) {
if (is_dir($item)) {
$suite->addDirectoryToBlacklist($item);
} else {
$suite->addFileToBlacklist($item);
}
}
} else {
foreach ($blacklist_items as $item) {
if (is_dir($item)) {
PHPUnit_Util_Filter::addDirectoryToFilter($item);
} else {
PHPUnit_Util_Filter::addFileToFilter($item);
}
}
}
}