mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/10586] some bootstrap additions and test changes to try and make it work
PHPBB3-10586
This commit is contained in:
parent
401de113f9
commit
9212466626
2 changed files with 38 additions and 4 deletions
|
@ -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_case.php';
|
||||||
require_once 'test_framework/phpbb_database_test_connection_manager.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', '>='))
|
if (version_compare(PHP_VERSION, '5.3.0-dev', '>='))
|
||||||
{
|
{
|
||||||
require_once 'test_framework/phpbb_functional_test_case.php';
|
require_once 'test_framework/phpbb_functional_test_case.php';
|
||||||
|
|
|
@ -14,8 +14,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
global $phpbb_extension_manager;
|
||||||
$phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache');
|
|
||||||
|
|
||||||
$phpbb_extension_manager->enable('foobar');
|
$phpbb_extension_manager->enable('foobar');
|
||||||
$phpbb_extension_manager->enable('foo_bar');
|
$phpbb_extension_manager->enable('foo_bar');
|
||||||
|
@ -25,8 +24,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
global $phpbb_extension_manager;
|
||||||
$phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache');
|
|
||||||
|
|
||||||
$phpbb_extension_manager->purge('foobar');
|
$phpbb_extension_manager->purge('foobar');
|
||||||
$phpbb_extension_manager->purge('foo_bar');
|
$phpbb_extension_manager->purge('foo_bar');
|
||||||
|
|
Loading…
Add table
Reference in a new issue