From 4936432d83f853ed83d754ee836aa912c2b32838 Mon Sep 17 00:00:00 2001 From: jgen Date: Tue, 18 Feb 2014 19:24:10 -0500 Subject: [PATCH] Copy the setup from index.php for All tests. --- tests/all_tests.php | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/tests/all_tests.php b/tests/all_tests.php index d52b48f9..67d5db89 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -12,8 +12,9 @@ require_once('lib/simpletest/autorun.php'); require_once('lib/simpletest/unit_tester.php'); require_once('lib/simpletest/web_tester.php'); require_once('lib/simpletest/reporter.php'); - -require_once('test_install.php'); +require_once("core/sys_config.inc.php"); +require_once("core/util.inc.php"); +require_once('tests/test_install.php'); $options = getopt("d:"); $db = $options["d"]; @@ -22,9 +23,42 @@ if (empty($db)){ die("Error: need to specifiy a database for the test environmen define("_TRAVIS_DATABASE", $db); +// Install Shimmie $test_suite = new TestSuite('Shimmie tests'); $test_suite->add(new ShimmieInstallerTest()); +// +// From index.php +// -//$tr = new TextReporter(); -//$test_suite->run( $tr ); +// set up and purify the environment +_version_check(); +_sanitise_environment(); + +// load base files +$files = array_merge(zglob("core/*.php"), zglob("ext/{".ENABLED_EXTS."}/main.php")); +foreach($files as $filename) { + require_once $filename; +} + +// connect to the database +$database = new Database(); +$config = new DatabaseConfig($database); + +// load the theme parts +foreach(_get_themelet_files(get_theme()) as $themelet) { + require_once $themelet; +} + +_load_extensions(); + +$page = class_exists("CustomPage") ? new CustomPage() : new Page(); +$user = _get_user(); +send_event(new InitExtEvent()); + +// Run all the tests +$all = new TestFinder(); +$all->run(new TextReporter()); + +// Is this really needed? +$database->commit();