diff options
author | David King <imkingdavid@gmail.com> | 2012-02-21 09:38:53 -0500 |
---|---|---|
committer | David King <imkingdavid@gmail.com> | 2012-03-19 09:12:32 -0400 |
commit | 9212466626a3d80a90cab1f23cf423a1c4e20655 (patch) | |
tree | 08d79e23ba3822b292a07e7689e4ce287728ba37 | |
parent | 401de113f9a0cec57c9648a079303d30fdb23666 (diff) | |
download | forums-9212466626a3d80a90cab1f23cf423a1c4e20655.tar forums-9212466626a3d80a90cab1f23cf423a1c4e20655.tar.gz forums-9212466626a3d80a90cab1f23cf423a1c4e20655.tar.bz2 forums-9212466626a3d80a90cab1f23cf423a1c4e20655.tar.xz forums-9212466626a3d80a90cab1f23cf423a1c4e20655.zip |
[ticket/10586] some bootstrap additions and test changes to try and make it work
PHPBB3-10586
-rw-r--r-- | tests/bootstrap.php | 36 | ||||
-rw-r--r-- | tests/functional/extension_controller_test.php | 6 |
2 files changed, 38 insertions, 4 deletions
diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 302701e3b3..e98ec384e6 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,6 +26,42 @@ require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; +// For functional tests, we need to make available the phpBB objects +require_once $phpbb_root_path . 'config.php'; +// Setup class loader first +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); +$phpbb_class_loader_ext->register(); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); +$phpbb_class_loader->register(); + +// set up caching +$cache_factory = new phpbb_cache_factory($acm_type); +$cache = $cache_factory->get_service(); +$phpbb_class_loader_ext->set_cache($cache->get_driver()); +$phpbb_class_loader->set_cache($cache->get_driver()); + +// We have to include this because the class loader doesn't +// recognize classes without the phpbb_ prefix +// So user and auth and the DBAL aren't found unless we require these files +require($phpbb_root_path . 'includes/session.' . $phpEx); +require($phpbb_root_path . 'includes/auth.' . $phpEx); +require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); +// Instantiate some basic classes +$user = new user(); +$auth = new auth(); +$db = new $sql_db(); + +$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); + +// We do not need this any longer, unset for safety purposes +unset($dbpasswd); + +// Grab global variables, re-cache if necessary +$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); + +// load extensions +$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + if (version_compare(PHP_VERSION, '5.3.0-dev', '>=')) { require_once 'test_framework/phpbb_functional_test_case.php'; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 7f0bccc485..430d93f9bf 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -14,8 +14,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { public function setUp() { - global $db, $cache; - $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + global $phpbb_extension_manager; $phpbb_extension_manager->enable('foobar'); $phpbb_extension_manager->enable('foo_bar'); @@ -25,8 +24,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function tearDown() { - global $db, $cache; - $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + global $phpbb_extension_manager; $phpbb_extension_manager->purge('foobar'); $phpbb_extension_manager->purge('foo_bar'); |