本文整理汇总了PHP中TestSuite::add方法的典型用法代码示例。如果您正苦于以下问题:PHP TestSuite::add方法的具体用法?PHP TestSuite::add怎么用?PHP TestSuite::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestSuite
的用法示例。
在下文中一共展示了TestSuite::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report
/**
* Genereates a nice report of the test.
*
* It instantiate a SimpleTest TestSuite and launches a Reporter.
* This method is typically called by a TestRunner.
*
* @return void
* @see KortTestRunner
* @see KortCliReporter
* @see KortHTMLReporter
*/
public function report()
{
$test = new \TestSuite($this->getLabel());
$test->add($this);
if (\TextReporter::inCli()) {
exit($test->run(new KortCliReporter()) ? 0 : 1);
}
$test->run(new KortHTMLReporter());
}
示例2: Form_Create
protected function Form_Create()
{
$filesToSkip = array("QUnitTestCaseBase.php", "QTestForm.tpl.php");
$arrFiles = QFolder::listFilesInFolder(__QCUBED_CORE__ . '/tests/qcubed-unit/');
$arrTests = array();
foreach ($arrFiles as $filename) {
if (!in_array($filename, $filesToSkip)) {
require_once __QCUBED_CORE__ . '/tests/qcubed-unit/' . $filename;
$arrTests[] = str_replace(".php", "", $filename);
}
}
$suite = new TestSuite('QCubed ' . QCUBED_VERSION_NUMBER_ONLY . ' Unit Tests - SimpleTest ' . SimpleTest::getVersion());
foreach ($arrTests as $className) {
$suite->add(new $className($this));
}
$suite->run(new QHtmlReporter());
}
示例3: TestSuite
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2013 Gina Trapani
*/
include 'init.tests.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/autorun.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/web_tester.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/mock_objects.php';
$RUNNING_ALL_TESTS = true;
$plugin_tests = new TestSuite('Plugin tests');
$plugin_tests->add(new TestOfExpandURLsPlugin());
$plugin_tests->add(new TestOfExpandURLsPluginConfigurationController());
$plugin_tests->add(new TestOfFlickrAPIAccessor());
$plugin_tests->add(new TestOfFacebookCrawler());
$plugin_tests->add(new TestOfFacebookPlugin());
$plugin_tests->add(new TestOfFacebookPluginConfigurationController());
$plugin_tests->add(new TestOfGeoEncoderPlugin());
$plugin_tests->add(new TestOfGeoEncoderPluginConfigurationController());
$plugin_tests->add(new TestOfMapController());
$plugin_tests->add(new TestOfTwitterAPIAccessorOAuth());
$plugin_tests->add(new TestOfTwitterAPIEndpoint());
$plugin_tests->add(new TestOfTwitterCrawler());
$plugin_tests->add(new TestOfTwitterInstanceMySQLDAO());
$plugin_tests->add(new TestOfTwitterPlugin());
$plugin_tests->add(new TestOfTwitterPluginConfigurationController());
$plugin_tests->add(new TestOfCrawlerTwitterAPIAccessorOAuth());
示例4: createSuiteFromClasses
/**
* Builds a test suite from a class list.
* @param string $title Title of new group.
* @param array $classes Test classes.
* @return TestSuite Group loaded with the new
* test cases.
*/
public function createSuiteFromClasses($title, $classes)
{
if (count($classes) == 0) {
$suite = new BadTestSuite($title, "No runnable test cases in [{$title}]");
return $suite;
}
SimpleTest::ignoreParentsIfIgnored($classes);
$suite = new TestSuite($title);
foreach ($classes as $class) {
if (!SimpleTest::isIgnored($class)) {
$suite->add($class);
}
}
return $suite;
}
示例5: TestSuite
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2011 Gina Trapani
*/
include 'init.tests.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/autorun.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/web_tester.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/mock_objects.php';
/* MODEL TESTS */
$model_tests = new TestSuite('Model tests');
$model_tests->add(new TestOfLogger());
$model_tests->add(new TestOfPDOCorePluginDAO());
$model_tests->add(new TestOfDAOFactory());
$model_tests->add(new TestOfConfig());
$model_tests->add(new TestOfCrawler());
$model_tests->add(new TestOfFollowMySQLDAO());
$model_tests->add(new TestOfFollowerCountMySQLDAO());
$model_tests->add(new TestOfGroupMySQLDAO());
$model_tests->add(new TestOfGroupMemberMySQLDAO());
$model_tests->add(new TestOfGroupMembershipCountMySQLDAO());
$model_tests->add(new TestOfInstanceMySQLDAO());
$model_tests->add(new TestOfInstaller());
$model_tests->add(new TestOfInstallerMySQLDAO());
$model_tests->add(new TestOfInviteMySQLDAO());
$model_tests->add(new TestOfLinkMySQLDAO());
$model_tests->add(new TestOfLoader());
示例6: dirname
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2013 Gina Trapani
*/
include dirname(__FILE__) . '/init.tests.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/autorun.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/web_tester.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/mock_objects.php';
/* MODEL TESTS */
$model_tests = new TestSuite('Model tests');
$model_tests->add(new TestOfLogger());
$model_tests->add(new TestOfPDOCorePluginDAO());
$model_tests->add(new TestOfDAOFactory());
$model_tests->add(new TestOfConfig());
$model_tests->add(new TestOfFileDataManager());
$model_tests->add(new TestOfCrawler());
$model_tests->add(new TestOfFollowMySQLDAO());
$model_tests->add(new TestOfCountHistoryMySQLDAO());
$model_tests->add(new TestOfGroupMySQLDAO());
$model_tests->add(new TestOfGroupMemberMySQLDAO());
$model_tests->add(new TestOfInsightBaselineMySQLDAO());
$model_tests->add(new TestOfInsightMySQLDAO());
$model_tests->add(new TestOfInsightTerms());
$model_tests->add(new TestOfInstanceMySQLDAO());
$model_tests->add(new TestOfDashboardModuleCacher());
$model_tests->add(new TestOfInsight());
示例7: TestSuite
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2013 Gina Trapani
*/
include 'init.tests.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/autorun.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/web_tester.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/mock_objects.php';
/* INSTALLER AND UPGRADER TESTS */
$installer_tests = new TestSuite('Installer tests');
$installer_tests->add(new WebTestOfInstallation());
if (!getenv("SKIP_UPGRADE_TESTS") == "1") {
$installer_tests->add(new WebTestOfUpgradeDatabase());
} else {
print "Note: Skipping WebTestOfUpgradeDatabase\n";
}
$tr = new TextReporter();
$start = (double) $usec + (double) $sec;
$installer_tests->run($tr);
if (getenv("TEST_TIMING") == "1") {
list($usec, $sec) = explode(" ", microtime());
$finish = (double) $usec + (double) $sec;
$runtime = round($finish - $start);
printf("Tests completed run in {$runtime} seconds\n");
}
if (isset($RUNNING_ALL_TESTS) && $RUNNING_ALL_TESTS) {
示例8: array
*/
include 'init.tests.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/autorun.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/web_tester.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/mock_objects.php';
/* CONTROLLER TESTS */
$controller_test_list = array("TestOfAccountConfigurationController", "TestOfActivateAccountController", "TestOfAppConfigController", "TestOfBackupController", "TestOfCheckCrawlerController", "TestOfCheckVersionController", "TestOfCrawlerAuthController", "TestOfDashboardController", "TestOfThinkUpEmbedController", "TestOfThreadJSController", "TestOfExportController", "TestOfExportServiceUserDataController", "TestOfForgotPasswordController", "TestOfGridController", "TestOfGridExportController", "TestOfInstallerController", "TestOfLoginController", "TestOfLogoutController", "TestOfPasswordResetController", "TestOfPostController", "TestOfRegisterController", "TestOfTestController", "TestOfTestAuthController", "TestOfTestAdminController", "TestOfToggleActiveInstanceController", "TestOfToggleActiveOwnerController", "TestOfToggleOwnerAdminController", "TestOfToggleActivePluginController", "TestOfTogglePublicInstanceController", "TestOfUserController", "TestOfPluginOptionController", "TestOfTestAuthAPIController", "TestOfRSSController", "TestOfUpgradeController", "TestOfPostAPIController", "TestOfStreamerAuthController", "TestOfUpdateNowController");
if (!getenv("TEST_TIMING") == "1") {
$controller_test = new TestSuite('Controller tests');
}
foreach ($controller_test_list as $test_name) {
include THINKUP_ROOT_PATH . 'tests/' . $test_name . '.php';
if (getenv("TEST_TIMING") == "1") {
$controller_test = new TestSuite($test_name);
}
$controller_test->add(new $test_name());
if (getenv("TEST_TIMING") == "1") {
$tr = new TextReporter();
list($usec, $sec) = explode(" ", microtime());
$start = (double) $usec + (double) $sec;
$controller_test->run($tr);
list($usec, $sec) = explode(" ", microtime());
$finish = (double) $usec + (double) $sec;
$runtime = round($finish - $start);
printf($runtime . " seconds\n");
}
}
if (!getenv("TEST_TIMING") == "1") {
$tr = new TextReporter();
list($usec, $sec) = explode(" ", microtime());
$start = (double) $usec + (double) $sec;
示例9: TestSuite
$test = new TestSuite('HTML Purifier Multiple Versions Test');
foreach ($versions_to_test as $version) {
// Support for arbitrarily forcing flushes by wrapping the suspect
// version name in an array()
$flush_arg = '';
if (is_array($version)) {
$version = $version[0];
$flush_arg = '--flush';
}
if ($AC['type'] !== 'phpt') {
$break = true;
switch ($AC['distro']) {
case '':
$break = false;
case 'normal':
$test->add(new CliTestCase("{$phpv} {$version} index.php --xml {$flush_arg} {$type_arg} --disable-phpt {$file_arg}", $AC['quiet'], $size));
if ($break) {
break;
}
case 'standalone':
$test->add(new CliTestCase("{$phpv} {$version} index.php --xml {$flush_arg} {$type_arg} --standalone --disable-phpt {$file_arg}", $AC['quiet'], $size));
if ($break) {
break;
}
}
}
if (!$AC['disable-phpt'] && (!$AC['type'] || $AC['type'] == 'phpt')) {
$test->add(new CliTestCase($AC['php'] . " index.php --xml --php \"{$phpv} {$version}\" --type=phpt", $AC['quiet'], $size));
}
}
// This is the HTML Purifier website's test XML file. We could
示例10: array
define('EXEC_VERSION', $versionInfo[1]);
$selected = array();
if (TextReporter::inCli()) {
$reporter = new TextReporter();
// take parameters as tests to run
while (1 < count($argv)) {
$selected[] = array_pop($argv);
}
} else {
$reporter = new HtmlReporter();
// run.php?selected[]=zerovalue&selected[]=lastline
if (isset($_GET) && array_key_exists('selected', $_GET)) {
$selected = (array) $_GET['selected'];
}
}
// All tests, grouped
$allTests = array('Base' => array('parser', 'config', 'ignorePackageTags', 'useClassPathAsPackage', 'namespaceSyntax', 'namespaceNameOverlap', 'traits'), 'Standard Doclet' => array('standardDoclet', 'accessLevel', 'accessLevelPHP5', 'throwsTag'), 'Bugfixes' => array('linefeed', 'lastLine', 'zeroValue', 'todoTag', 'commentLinks'), 'Formatters' => array('listsUl', 'markdown'));
$suite = new TestSuite('PHPDoctor');
foreach ($allTests as $name => $tests) {
$group = new TestSuite($name);
foreach ($tests as $test) {
if (!$selected || in_array($test, $selected)) {
$group->addFile(sprintf('tests/cases/Test%s.php', ucwords($test)));
}
}
$suite->add($group);
}
if (TextReporter::inCli()) {
exit($suite->run($reporter) ? 0 : 1);
}
$suite->run($reporter);
示例11: add
public function add($test_case)
{
parent::add($test_case);
$this->testCases[] = $test_case;
}
示例12: explode
* <http://www.gnu.org/licenses/>.
*
*
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2013 Gina Trapani
*/
include 'init.tests.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/autorun.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/web_tester.php';
require_once THINKUP_WEBAPP_PATH . '_lib/extlib/simpletest/mock_objects.php';
$RUNNING_ALL_TESTS = true;
$version = explode('.', PHP_VERSION);
//dont run redis test for php less than 5.3
$plugin_tests = new TestSuite('Plugin tests');
$plugin_tests->add(new TestOfExpandURLsPlugin());
$plugin_tests->add(new TestOfExpandURLsPluginConfigurationController());
$plugin_tests->add(new TestOfFlickrAPIAccessor());
$plugin_tests->add(new TestOfFacebookCrawler());
$plugin_tests->add(new TestOfFacebookPlugin());
$plugin_tests->add(new TestOfFacebookPluginConfigurationController());
$plugin_tests->add(new TestOfGeoEncoderPlugin());
$plugin_tests->add(new TestOfGeoEncoderPluginConfigurationController());
$plugin_tests->add(new TestOfMapController());
$plugin_tests->add(new TestOfTwitterAPIAccessorOAuth());
$plugin_tests->add(new TestOfTwitterAPIEndpoint());
$plugin_tests->add(new TestOfTwitterCrawler());
$plugin_tests->add(new TestOfTwitterInstanceMySQLDAO());
$plugin_tests->add(new TestOfTwitterPlugin());
$plugin_tests->add(new TestOfTwitterPluginConfigurationController());
$plugin_tests->add(new TestOfTwitterPluginHashtagConfigurationController());
示例13: runSelectedTests
/**
* Run unit tests selected via checkbox
* @return TestGui
*/
public function runSelectedTests()
{
self::getAvailableTests();
// just to include all files
if (array_key_exists('runtest', $_REQUEST)) {
// logging
require_once dirname(__FILE__) . DS . 'SimpleHtmlReporter.php';
$out = "\n" . str_repeat('=', 50) . "\nStarting tests, executed by user [" . self::getUserName() . "]. Deleted [" . TestUtils::flushTempDir() . "] files from temp dir [" . DIR_TEMP . "]\n" . str_repeat('=', 50);
TestUtils::log($out, self::LOGNAME, TestUtils::LEVEL_INFO);
$selected_tests = array();
foreach ($_REQUEST['runtest'] as $test_case => $methods) {
if (is_array($methods)) {
$selected_tests[$test_case] = array_keys($methods);
} else {
$this->errors[] = '<div class="alert alert-error">Caution - TestCase "' . $test_case . '" has no selected unit test.</div>';
}
}
$reporter = new SimpleHtmlReporter();
$reporter->setTests($selected_tests);
$test_suite = new TestSuite();
foreach ($selected_tests as $class => $methods) {
/**
* @var WebTestCase
*/
$test_case = new $class();
// uprav nastavenia podla typu prostredia
$modifier_class = $class . 'Set';
if (class_exists($modifier_class, false)) {
// pozri priklad v testing/database.php
$test_case = call_user_func(array($modifier_class, 'set'), $test_case);
}
$test_suite->add($test_case);
}
$test_suite->run($reporter);
self::$output_result_tests = $reporter->getOutput();
// logging
foreach ($reporter->getStatus() as $name => $test_case) {
$log = '[' . $test_case['passed'] . '] passed, [' . $test_case['failed'] . '] failed for [' . $name . ']. Executed methods: ' . implode(', ', $test_case['methods']);
if (sizeof($test_case['messages']) > 0) {
$log .= "\n" . implode("\n", $test_case['messages']);
}
TestUtils::log(strip_tags($log), self::LOGNAME, TestUtils::LEVEL_INFO);
}
$timeMemory = " -- Execution time [" . TestUtils::execTime() . '], memory usage [' . TestUtils::getMemoryUsage() . ']';
TestUtils::log($timeMemory, self::LOGNAME, TestUtils::LEVEL_INFO);
}
return self::$instance;
}
示例14: run
/**
* ユニットテストを実行する
*
* @access private
* @return mixed 0:正常終了 Ethna_Error:エラー
*/
function run()
{
$action_class_list = $this->_getTestAction();
$view_class_list = $this->_getTestView();
$test = new TestSuite("Ethna UnitTest");
// アクション
foreach ($action_class_list as $action_name) {
$action_class = $this->ctl->getDefaultActionClass($action_name, false) . '_TestCase';
$action_form = $this->ctl->getDefaultFormClass($action_name, false) . '_TestCase';
$test->add(new $action_class($this->ctl));
$test->add(new $action_form($this->ctl));
}
// ビュー
foreach ($view_class_list as $view_name) {
$view_class = $this->ctl->getDefaultViewClass($view_name, false) . '_TestCase';
$test->add(new $view_class($this->ctl));
}
// 一般
foreach ($this->testcase as $class_name => $file_name) {
$dir = $this->ctl->getBasedir() . '/';
include_once $dir . $file_name;
$testcase_name = $class_name . '_TestCase';
$test->add(new $testcase_name($this->ctl));
}
// ActionFormのバックアップ
$af = $this->ctl->getActionForm();
//出力したい形式にあわせて切り替える
$cli_enc = $this->ctl->getClientEncoding();
$reporter = new Ethna_UnitTestReporter($cli_enc);
$test->run($reporter);
// ActionFormのリストア
$this->ctl->setActionForm($af);
$this->backend->setActionForm($af);
return array($reporter->report, $reporter->result);
}
示例15: dirname
<?php
// $Id$
require_once '../detached.php';
require_once '../reporter.php';
// The following URL will depend on your own installation.
$command = 'php ' . dirname(__FILE__) . '/visual_test.php --xml';
$test = new TestSuite('Remote tests');
$test->add(new DetachedTestCase($command, $command . ' --dry'));
if (SimpleReporter::inCli()) {
exit($test->run(new NoPassesReporter(new TextReporter())) ? 0 : 1);
}
$test->run(new NoPassesReporter(new HtmlReporter()));