本文整理汇总了PHP中PHPUnit_Framework_TestSuite::testCount方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestSuite::testCount方法的具体用法?PHP PHPUnit_Framework_TestSuite::testCount怎么用?PHP PHPUnit_Framework_TestSuite::testCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestSuite
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestSuite::testCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* @access public
* @static
*/
public static function main()
{
self::_initConfiguration();
self::_initSuitesAndTests();
self::_initArguments();
$runner = new PHPUnit_TextUI_TestRunner();
$master_suite = new PHPUnit_Framework_TestSuite('Zend Framework');
$loadable_suites = array();
if (count(self::$_arguments['suite_filter']) > 0) {
$first_pass = true;
foreach (self::$_arguments['suite_filter'] as $suite_filter) {
// if the suite filter is not valid class name (extranious char.) - continue
if (!preg_match("/[a-z0-9\\-_.]/i", $suite_filter)) {
continue;
}
if ($suite_filter[0] != "@" && strpos($suite_filter, "#") === false) {
/**
* This block will parse all filters below the named suite (branch)
*/
foreach (self::$_test_suites as $test_suite) {
if (strpos($test_suite, $suite_filter) !== false) {
$suite_config = ZFTestManager::getConfig($test_suite);
if (isset($suite_config['disabled']) && $suite_config['disabled'] == true) {
continue;
}
$loadable_suites[$test_suite] = null;
}
}
} elseif ($suite_filter[0] == "@") {
/**
* This block will mark only
*/
$suite_filter_base = ltrim($suite_filter, "@");
if (in_array($suite_filter_base, self::$_test_suites)) {
$loadable_suites[$suite_filter_base] = null;
} else {
continue;
}
// remove branches deeper than this one if they exist
foreach (self::$_test_suites as $test_suite_id => $test_suite) {
if (strpos($test_suite, $suite_filter_base) === 0) {
unset(self::$_test_suites[$test_suite_id]);
}
}
continue;
} elseif (strpos($suite_filter, "#") !== false) {
list($suite_filter_base, $suite_filter_testcase) = split("#", $suite_filter);
if ($suite_filter_base != "" && $suite_filter_testcase != "") {
$loadable_suites[$suite_filter_base] = $suite_filter_testcase;
}
}
}
} else {
foreach (self::$_test_suites as $suite_name) {
$suite_config = ZFTestManager::getConfig($suite_name);
if (isset($suite_config['disabled']) && $suite_config['disabled'] == true) {
continue;
}
$loadable_suites[$suite_name] = null;
}
}
foreach ($loadable_suites as $suite_name => $sub_suite) {
$runner->getLoader()->load($suite_name . "_AllTests", str_replace("_", DIRECTORY_SEPARATOR, $suite_name) . DIRECTORY_SEPARATOR . "AllTests.php");
$classname = $suite_name . "_AllTests";
$master_suite->addTestSuite(call_user_func(array($classname, "suite"), $sub_suite));
}
if ($master_suite->testCount() == 0) {
self::_printVersionString();
echo "\nNo tests found in the current working directory.\n\n";
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
}
try {
self::_printVersionString(false);
$runner_parameters = array_merge(self::$_configuration['runner_parameters'], self::$_arguments['runner_parameters']);
$result = $runner->doRun($master_suite, $runner_parameters);
} catch (Exception $e) {
throw new RuntimeException('Could not create and run test suite: ' . $e->getMessage());
}
if ($result->wasSuccessful()) {
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
} else {
if ($result->errorCount() > 0) {
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
} else {
exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
}
}
}