mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/10586] Now tests run, but fail. But here is what I have.
PHPBB3-10586
This commit is contained in:
parent
9212466626
commit
a37a28b485
3 changed files with 24 additions and 38 deletions
|
@ -26,42 +26,6 @@ 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,7 +14,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
global $phpbb_extension_manager;
|
parent::setUp();
|
||||||
|
$phpbb_extension_manager = $this->get_ext_manager();
|
||||||
|
|
||||||
$phpbb_extension_manager->enable('foobar');
|
$phpbb_extension_manager->enable('foobar');
|
||||||
$phpbb_extension_manager->enable('foo_bar');
|
$phpbb_extension_manager->enable('foo_bar');
|
||||||
|
@ -24,7 +25,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
global $phpbb_extension_manager;
|
parent::tearDown();
|
||||||
|
$phpbb_extension_manager = $this->get_ext_manager();
|
||||||
|
|
||||||
$phpbb_extension_manager->purge('foobar');
|
$phpbb_extension_manager->purge('foobar');
|
||||||
$phpbb_extension_manager->purge('foo_bar');
|
$phpbb_extension_manager->purge('foo_bar');
|
||||||
|
|
|
@ -66,6 +66,26 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function get_db()
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
if (!class_exists('dbal_' . self::$config['dbms']))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx");
|
||||||
|
}
|
||||||
|
$sql_db = 'dbal_' . self::$config['dbms'];
|
||||||
|
$db = new $sql_db();
|
||||||
|
$db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']);
|
||||||
|
return $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get_ext_manager()
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_null);
|
||||||
|
}
|
||||||
|
|
||||||
protected function install_board()
|
protected function install_board()
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
Loading…
Add table
Reference in a new issue