本文整理汇总了PHP中PHPUnit_Util_Filter类的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Filter类的具体用法?PHP PHPUnit_Util_Filter怎么用?PHP PHPUnit_Util_Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PHPUnit_Util_Filter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructs a new test suite instance.
*/
public function __construct()
{
$this->setName('pFlow::AllTests');
\PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../src/pFlow'));
$this->addTestSuite('\\pFlow\\AnalyzerTest');
$this->addTestSuite('\\pFlow\\CliTest');
}
示例2: process
/**
* Classe capable de prendre en charge les suites de test à lancer depuis le point d'entrée
* test.php
* Actuellement capable de lancer uniquement les tests relatifs au framework. Par la suite
* il est souhaitable qu'il puisse prendre en charge le lancement des tests fonctionnels.
*
* @param array $pParams Tableau de paramètres
*
* @todo être capable de lancer les tests fonctionnels avec ce controller.
*/
public function process($pParams)
{
if (@(include_once 'PHPUnit/Framework.php')) {
require_once COPIX_PATH . 'tests/CopixTest.class.php';
require_once COPIX_PATH . 'tests/CopixDBTest.class.php';
require_once COPIX_PATH . 'tests/CopixTestRunner.class.php';
require_once COPIX_PATH . 'tests/CopixTestPrinter.class.php';
require_once COPIX_PATH . 'tests/CopixTestXMLPrinter.class.php';
// Ignore les fichiers de framework de test
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__) . '/framework');
$this->_configFile = isset($pParams['conf']) ? $pParams['conf'] : '../project/config/copix.conf.php';
if (!isset($_REQUEST['tests'])) {
$this->testWelcome();
} else {
if (!isset($pParams['xml']) || $pParams['xml'] == false) {
$options['reportDirectory'] = COPIX_TEMP_PATH;
}
$options['xml'] = isset($pParams['xml']) && $pParams['xml'];
CopixTestRunner::run($this->_getSuite(), $options);
}
} else {
$this->showRequiredPHPUnit();
}
}
示例3: __construct
/**
* Constructs a new test suite instance.
*/
public function __construct()
{
$this->setName('PHP::ChangeCoverage::Report::AllTests');
PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../../../source/'));
$this->addTestSuite('PHP_ChangeCoverage_Report_CloverUnitTest');
$this->addTestSuite('PHP_ChangeCoverage_Report_FactoryUnitTest');
}
示例4: addFailure
/**
* A failure occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_AssertionFailedError $e
* @param float $time
*/
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$this->write('fail: ' . $e->getMessage());
$trace = current(PHPUnit_Util_Filter::getFilteredStacktrace($e, FALSE));
$this->write('trace: ' . print_r($trace, 1));
$this->currentTestPass = FALSE;
}
示例5: __toString
/**
* @return string
*/
public function __toString()
{
$string = PHPUnit_Framework_TestFailure::exceptionToString($this);
if ($trace = PHPUnit_Util_Filter::getFilteredStacktrace($this)) {
$string .= "\n" . $trace;
}
return $string;
}
示例6: 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;
}
示例7: beforeRunTests
/**
* Overwrites beforeRunTests. Initiates coverage-report generation if
* $coverage has been set to true (@see setCoverageStatus).
*/
protected function beforeRunTests()
{
if ($this->getCoverageStatus()) {
// blacklist selected folders from coverage report
foreach (TestRunner::$coverage_filter_dirs as $dir) {
PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
}
$this->getFrameworkTestResults()->collectCodeCoverageInformation(true);
}
}
示例8: __construct
/**
* Constructs a new test suite instance.
*/
public function __construct()
{
$this->setName('PHP::ChangeCoverage::AllTests');
PHPUnit_Util_Filter::addDirectoryToWhitelist(realpath(dirname(__FILE__) . '/../../../source/'));
$this->addTest(PHP_ChangeCoverage_ChangeSet_AllTests::suite());
$this->addTest(PHP_ChangeCoverage_Source_AllTests::suite());
$this->addTest(PHP_ChangeCoverage_Report_AllTests::suite());
$this->addTestSuite('PHP_ChangeCoverage_PHPUnitUnitTest');
$this->addTestSuite('PHP_ChangeCoverage_XdebugUnitTest');
}
示例9: failureDescription
/**
* Returns the description of the failure
*
* The beginning of failure messages is "Failed asserting that" in most
* cases. This method should return the second part of that sentence.
*
* @param mixed $other Evaluated value or object.
*
* @return string
*/
protected function failureDescription($other)
{
if ($other !== null) {
$message = '';
if ($other instanceof Throwable) {
$message = '. Message was: "' . $other->getMessage() . '" at' . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($other);
}
return sprintf('exception of type "%s" matches expected exception "%s"%s', get_class($other), $this->className, $message);
}
return sprintf('exception of type "%s" is thrown', $this->className);
}
示例10: suite
/**
* TestSuite
*/
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('sfReplicaThumbnailPlugin');
// Replica tests
$suite->addTestFile(DIR_SF_REPLICA . '/lib/vendor/Replica/test/AllTests.php');
PHPUnit_Util_Filter::removeDirectoryFromWhitelist(DIR_SF_REPLICA . '/lib/vendor');
// Plugin tests
$runner = new PHPUnit_TextUI_TestRunner(new PHPUnit_Runner_StandardTestSuiteLoader());
$suite->addTest($runner->getTest(dirname(__FILE__) . '/unit'));
return $suite;
}
示例11: formatError
private function formatError($type, PHPUnit_Framework_Test $test, Exception $e)
{
if ($test != null) {
$this->endTest($test, time());
}
$this->inner .= $test->getName() . " " . $type . "\n";
if ($e !== null) {
$this->inner .= $e->getMessage() . "\n";
$this->inner .= PHPUnit_Util_Filter::getFilteredStackTrace($e) . "\n";
}
}
示例12: handleError
public static function handleError($level, $message, $file, $line)
{
$isFiltered = false;
if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0) {
$isFiltered = PHP_CodeCoverage::getInstance()->filter()->isFiltered($file, array(), true);
} else {
$isFiltered = PHPUnit_Util_Filter::isFiltered($file, true, true);
}
if (!$isFiltered) {
return PHPUnit_Util_ErrorHandler::handleError($level, $message, $file, $line);
}
}
示例13: blacklistDirectories
public function blacklistDirectories()
{
$directories = new DirectoryIterator(PROJECT_ROOT . DS . 'modules');
foreach ($directories as $directory) {
if (!$directory->isDot() && $directory->isDir()) {
$path = $directory->getPathname() . DS . '_tests';
if (is_dir($path)) {
PHPUnit_Util_Filter::addDirectoryToFilter($path, '.php');
}
}
}
}
示例14: prepareMessage
/**
* @param \Exception $exception
* @param string $dataSetName
* @param mixed $dataSet
* @return string
*/
protected function prepareMessage(\Exception $exception, $dataSetName, $dataSet)
{
if (!is_string($dataSetName)) {
$dataSetName = var_export($dataSet, true);
}
if ($exception instanceof \PHPUnit_Framework_AssertionFailedError && !$exception instanceof \PHPUnit_Framework_IncompleteTestError && !$exception instanceof \PHPUnit_Framework_SkippedTestError || $this->_options['verbose']) {
$dataSetName = 'Data set: ' . $dataSetName . PHP_EOL;
} else {
$dataSetName = '';
}
return $dataSetName . $exception->getMessage() . PHP_EOL . \PHPUnit_Util_Filter::getFilteredStacktrace($exception);
}
示例15: suite
public static function suite()
{
PHPUnit_Util_Filter::addDirectoryToFilter(dirname(__FILE__));
$suite = new PHPUnit_Framework_TestSuite();
$suite->setName('SimpleDOM');
foreach (glob(dirname(__FILE__) . '/*.php') as $filepath) {
$name = basename($filepath, '.php');
if ($name != 'AllTests') {
$suite->addTestFile($filepath);
}
}
return $suite;
}