The class will be instantiated if it's a test suite.
public add ( SimpleTestCase $test_case ) | ||
$test_case | SimpleTestCase | Suite or individual test case implementing the runnable test interface. |
/** * 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()); }
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()); }
* * 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());
/** * 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; }
* * 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());
* * 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());
* * 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) {
*/ 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;
$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
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);
public function add($test_case) { parent::add($test_case); $this->testCases[] = $test_case; }
* <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());
/** * 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; }
/** * ユニットテストを実行する * * @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); }
<?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()));
*/ /* $Id$ */ error_reporting(E_ALL); require_once 'simpletest/unit_tester.php'; require_once 'simpletest/reporter.php'; if (!empty($argc) and $argc > 1) { // If command line arguments are given, then only test those. array_shift($argv); $tests = $argv; $group = new TestSuite('Selected PEL tests'); } else { // otherwive test all .php files, except this file (run-tests.php). $tests = array_diff(glob(dirname(__FILE__) . '/*.php'), array('run-tests.php', 'config.local.php', 'config.local.example.php')); $group = new TestSuite('All PEL tests'); // Also test all image tests (if they are available). if (is_dir(dirname(__FILE__) . '/image-tests')) { $image_tests = array_diff(glob(dirname(__FILE__) . '/image-tests/*.php'), array(dirname(__FILE__) . '/image-tests/make-image-test.php')); $image_group = new TestSuite('Image Tests'); foreach ($image_tests as $image_test) { $image_group->addFile($image_test); } $group->add($image_group); } else { echo "Found no image tests, only core functionality will be tested.\n"; echo "Image tests are available from http://github.com/lsolesen/pel/.\n"; } } foreach ($tests as $test) { $group->addFile($test); } $group->run(new TextReporter());
<?php require_once 'simpletest/unit_tester.php'; require_once 'simpletest/reporter.php'; require_once dirname(__FILE__) . '/addendum_test.php'; require_once dirname(__FILE__) . '/acceptance_test.php'; require_once dirname(__FILE__) . '/annotation_test.php'; require_once dirname(__FILE__) . '/constrained_annotation_test.php'; require_once dirname(__FILE__) . '/annotation_parser_test.php'; require_once dirname(__FILE__) . '/doc_comment_test.php'; $suite = new TestSuite('All tests'); $suite->add(new TestOfAddendum()); $suite->add(new TestOfAnnotations()); $suite->add(new TestOfPerformanceFeatures()); $suite->add(new TestOfSupportingFeatures()); $suite->add(new TestOfAnnotation()); $suite->add(new TestOfAnnotationCollection()); $suite->add(new TestOfConstrainedAnnotation()); $suite->add(new TestOfMatchers()); $suite->add(new TestOfAnnotationMatchers()); $suite->add(new TestOfDocComment()); if (version_compare(PHP_VERSION, '5.3.0') >= 0) { require_once dirname(__FILE__) . '/namespaces_test.php'; $suite->add(new TestOfNamespaces()); } $reporter = TextReporter::inCli() ? new TextReporter() : new HtmlReporter(); Addendum::setRawMode(false); $suite->run($reporter); Addendum::setRawMode(true); $suite->run($reporter);
public function skip() { $this->skipIf(false); $this->skipUnless(true); } public function testFail() { $this->fail('We should see this message'); } public function testPass() { $this->pass('We should see this message'); } } $test = new TestSuite('Visual test with 46 passes, 47 fails and 0 exceptions'); $test->add(new PassingUnitTestCaseOutput()); $test->add(new FailingUnitTestCaseOutput()); $test->add(new TestOfMockObjectsOutput()); $test->add(new TestOfPastBugs()); $test->add(new TestOfVisualShell()); $test->add(new TestOfSkippingNoMatterWhat()); $test->add(new TestOfSkippingOrElse()); $test->add(new TestOfSkippingTwiceOver()); $test->add(new TestThatShouldNotBeSkipped()); if (isset($_GET['xml']) || in_array('xml', isset($argv) ? $argv : array())) { $reporter = new XmlReporter(); } elseif (TextReporter::inCli()) { $reporter = new TextReporter(); } else { $reporter = new PassesAsWellReporter(); }
* 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 2014-2015 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; $eoy_insight_tests = new TestSuite('EOY insight tests'); //EOY insight tests $eoy_insight_tests->add(new TestOfEOYMostFavlikedPostInsight()); $eoy_insight_tests->add(new TestOfEOYAllAboutYouInsight()); $eoy_insight_tests->add(new TestOfEOYMostTalkativeDayInsight()); $eoy_insight_tests->add(new TestOfEOYPopularPicInsight()); $eoy_insight_tests->add(new TestOfEOYExclamationCountInsight()); $eoy_insight_tests->add(new TestOfEOYFBombCountInsight()); $eoy_insight_tests->add(new TestOfEOYBiggestFansInsight()); $eoy_insight_tests->add(new TestOfEOYGenderAnalysisInsight()); $eoy_insight_tests->add(new TestOfEOYMostRetweetedPostInsight()); $eoy_insight_tests->add(new TestOfEOYBestieInsight()); $eoy_insight_tests->add(new TestOfEOYMostLinksInsight()); $eoy_insight_tests->add(new TestOfEOYWordCountInsight()); $eoy_insight_tests->add(new TestOfEOYMostConversationInsight()); $eoy_insight_tests->add(new TestOfEOYLOLCountInsight()); $eoy_insight_tests->add(new TestOfEOYPopularLinkInsight()); $eoy_insight_tests->add(new TestOfEOYWhoYouFavedInsight());
<?php if (defined('ABSPATH')) { require_once ABSPATH . 'config.php'; } else { if (file_exists('config.php')) { require_once 'config.php'; } else { echo 'TestSuiteClassA.php : Cannot locate config.php'; } } require_once ABSPATH . PUNIT_PATH . 'TestSuite.php'; $suite = new TestSuite(); $suite->setName('hello'); echo 'Suite name ', $suite->getName(); $suite->add('TestClassA'); $suite->run(); $results = $suite->getResults(); foreach ($results as $result) { echo ' Test Case Name : ', $result->getName(); echo ' Total Time : ', $result->getTotalTime(); echo ' Successes : ', $result->getTotalSuccesses(); echo ' Failures : ', $result->getTotalFailures(); echo ' Errors : ', $result->getTotalErrors(); }
* * 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-2012 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'; $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 TestOfTwitterAuthController()); $plugin_tests->add(new TestOfTwitterCrawler()); $plugin_tests->add(new TestOfTwitterInstanceMySQLDAO()); $plugin_tests->add(new TestOfTwitterOAuth()); $plugin_tests->add(new TestOfTwitterPlugin()); $plugin_tests->add(new TestOfTwitterPluginConfigurationController());
<?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)); if (SimpleReporter::inCli()) { exit($test->run(new TextReporter()) ? 0 : 1); } $test->run(new HtmlReporter());
* * 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'; /* CONTROLLER TESTS */ $controller_test = new TestSuite('Controller tests'); $controller_test->add(new TestOfAccountConfigurationController()); $controller_test->add(new TestOfActivateAccountController()); $controller_test->add(new TestOfAppConfigController()); $controller_test->add(new TestOfBackupController()); $controller_test->add(new TestOfCheckCrawlerController()); $controller_test->add(new TestOfCrawlerAuthController()); $controller_test->add(new TestOfDashboardController()); $controller_test->add(new TestOfThinkUpEmbedController()); $controller_test->add(new TestOfThreadJSController()); $controller_test->add(new TestOfExportController()); $controller_test->add(new TestOfExportServiceUserDataController()); $controller_test->add(new TestOfForgotPasswordController()); $controller_test->add(new TestOfGridController()); $controller_test->add(new TestOfGridExportController()); $controller_test->add(new TestOfInstallerController()); $controller_test->add(new TestOfLoginController());
/** * * @author Wayne Ashley <*****@*****.**> * @copyright 2015 Wayne Ashley * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPL-3.0) * */ $st = $nvBoot->fetch_entry('core') . '/classes/simpletest/'; $nv = $st . 'nvoy/'; /* list of test files to include */ require_once $nv . 'frontend.php'; require_once $nv . 'backend.php'; require_once $nv . 'nvreporter.php'; /* reporter options */ $ro = array('passes' => 0); /* test options */ $to = array('http' => 'http://' . $_SERVER['SERVER_NAME'], 'https' => 'https://' . $_SERVER['SERVER_NAME'], 'session_id' => session_id(), 'captcha' => $_SESSION['captcha'], 'core' => $nvBoot->fetch_entry('core')); /* grab a reporter and pass in some options */ $reporter = new nvReporter(); $reporter->setOptions($ro); /* grab the frontend tests and pass in some options */ $frontend = new Frontend('Front End'); $frontend->setOptions($to); /* grab the backend tests and pass in some options */ $backend = new Backend('Back End'); $backend->setOptions($to); /* load all the tests inside the testsuite and apply our own styling */ $test = new TestSuite('nvoy Tests'); $test->add($frontend); $test->add($backend); $test->run($reporter);
<?php // $Id$ require_once dirname(__FILE__) . '/../default_server.php'; require_once dirname(__FILE__) . '/../remote.php'; require_once dirname(__FILE__) . '/../reporter.php'; // nasty hack: ensure the commanline i processed before anything else in here so that the default server URI can indeed be set by the user: $ignore_me = new DefaultReporter(); // The following URL will depend on your own installation. $test_url = str_replace('site/', 'visual_test.php', WebserverDefaults::getServerUrl()); if (isset($_SERVER['SCRIPT_URI'])) { $base_uri = $_SERVER['SCRIPT_URI']; $test_url = str_replace('remote_test.php', 'visual_test.php', $base_uri); } elseif (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['PHP_SELF'])) { $base_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $test_url = str_replace('remote_test.php', 'visual_test.php', $base_uri); } $test = new TestSuite('Remote tests'); $test->add(new RemoteTestCase($test_url . '?xml=yes', $test_url . '?xml=yes&dry=yes')); if (SimpleReporter::inCli()) { exit($test->run(new NoPassesReporter(new TextReporter())) ? 0 : 1); } $test->run(new NoPassesReporter(new HtmlReporter()));
* * 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-2015 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'; /* INTEGRATION TESTS */ $web_tests = new TestSuite('Integration tests'); $web_tests->add(new WebTestOfApplicationSettings()); $web_tests->add(new WebTestOfCaptchaImage()); $web_tests->add(new WebTestOfChangePassword()); $web_tests->add(new WebTestOfCrawlerRun()); $web_tests->add(new WebTestOfCSRFToken()); $web_tests->add(new WebTestOfDeleteInstance()); $web_tests->add(new WebTestOfForgottonPassword()); $web_tests->add(new WebTestOfLogin()); $web_tests->add(new WebTestOfLogout()); $web_tests->add(new WebTestOfRegistration()); $tr = new TextReporter(); $start = (double) $usec + (double) $sec; $web_tests->run($tr); if (getenv("TEST_TIMING") == "1") { list($usec, $sec) = explode(" ", microtime()); $finish = (double) $usec + (double) $sec;
function testInstallShimmie() { // Get the settings from the global constants. $db = constant("_TRAVIS_DATABASE"); $host = constant("_TRAVIS_WEBHOST"); $username = constant("_TRAVIS_DATABASE_USERNAME"); $password = constant("_TRAVIS_DATABASE_PASSWORD"); // Make sure that we know where the host is. $this->assertFalse(empty($host)); // Make sure that we know what database to use. $this->assertFalse(empty($db)); $this->get($host); $this->assertResponse(200); $this->assertTitle("Shimmie Installation"); $this->assertText("Database Install"); $this->setField("database_type", $db); $this->assertField("database_type", $db); $this->assertField("database_host", "localhost"); $this->setField("database_user", $username); $this->setField("database_password", $password); $this->assertField("database_name", "shimmie"); $this->clickSubmit("Go!"); if (!$this->assertText("Installation Succeeded!")) { print "ERROR --- '" . $db . "'"; $this->showSource(); } } } $test = new TestSuite('Install Shimmie'); $test->add(new ShimmieInstallerTest()); exit($test->run(new TextReporter()) ? 0 : 1);
* * 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'; /* INTEGRATION TESTS */ $web_tests = new TestSuite('Integration tests'); $web_tests->add(new WebTestOfApplicationSettings()); $web_tests->add(new WebTestOfCaptchaImage()); $web_tests->add(new WebTestOfChangePassword()); $web_tests->add(new WebTestOfCrawlerRun()); $web_tests->add(new WebTestOfCSRFToken()); $web_tests->add(new WebTestOfDashboard()); $web_tests->add(new WebTestOfDeleteInstance()); $web_tests->add(new WebTestOfLogin()); $web_tests->add(new WebTestOfPostDetailPage()); $web_tests->add(new WebTestOfRegistration()); $web_tests->add(new WebTestOfTwitterDashboard()); $tr = new TextReporter(); $web_tests->run($tr); if (isset($RUNNING_ALL_TESTS) && $RUNNING_ALL_TESTS) { $TOTAL_PASSES = $TOTAL_PASSES + $tr->getPassCount(); $TOTAL_FAILURES = $TOTAL_FAILURES + $tr->getFailCount();
* <http://www.gnu.org/licenses/>. * * * @author Gina Trapani <ginatrapani[at]gmail[dot]com> * @license http://www.gnu.org/licenses/gpl.html * @copyright 2009-2016 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 TestOfFacebookInstanceMySQLDAO()); $plugin_tests->add(new TestOfFacebookPluginConfigurationController()); $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()); $plugin_tests->add(new TestOfCrawlerTwitterAPIAccessorOAuth()); $plugin_tests->add(new TestOfRetweetDetector());
function addTestFile($file, $internalcall = false) { if ($this->showsearch) { if ($internalcall) { echo '<li><b>' . basename($file) . '</b></li>'; } else { echo '<p>Adding test file: ' . realpath($file) . '</p>'; } // Make sure that syntax errors show up suring the search, otherwise you often // get blank screens because evil people turn down error_reporting elsewhere. error_reporting(E_ALL); } if (!is_file($file)) { parent::add(new BadTest($file, 'Not a file or does not exist')); } parent::addFile($file); }