mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge pull request #4171 from CHItA/ticket/14462
[ticket/14462] Try to prevent timeouts in the installer * CHItA/ticket/14462: [ticket/14462] Not show timeout messages in convertors [ticket/14462] Make timeout error translateable [ticket/14462] Update ordering in install db config [ticket/14462] Fix comments [ticket/14462] Fix tests [ticket/14462] Fix CS and typo [ticket/14462] Set instance of db driver for database access using global [ticket/14462] Fix installation in tests [ticket/14462] Refactor tasks to be more modular [ticket/14462] Further speed improvements
This commit is contained in:
@@ -52,8 +52,8 @@ class phpbb_installer_config_test extends phpbb_test_case
|
||||
|
||||
public function test_progress_tracking()
|
||||
{
|
||||
$this->config->set_finished_task('foo');
|
||||
$this->config->set_active_module('bar');
|
||||
$this->config->set_finished_task(0);
|
||||
$this->config->set_active_module('bar', 5);
|
||||
$this->config->set_task_progress_count(10);
|
||||
$this->config->increment_current_task_progress();
|
||||
|
||||
@@ -66,7 +66,8 @@ class phpbb_installer_config_test extends phpbb_test_case
|
||||
$result = $this->config->get_progress_data();
|
||||
$expected_result = array(
|
||||
'last_task_module_name' => 'bar',
|
||||
'last_task_name' => 'foo',
|
||||
'last_task_module_index' => 5,
|
||||
'last_task_index' => 0,
|
||||
'max_task_progress' => 10,
|
||||
'current_task_progress' => 3,
|
||||
);
|
||||
|
@@ -20,6 +20,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
static protected $client;
|
||||
static protected $cookieJar;
|
||||
static protected $root_url;
|
||||
static protected $install_success = false;
|
||||
|
||||
protected $cache = null;
|
||||
protected $db = null;
|
||||
@@ -78,6 +79,11 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if (!self::$install_success)
|
||||
{
|
||||
$this->fail('Installing phpBB has failed.');
|
||||
}
|
||||
|
||||
$this->bootstrap();
|
||||
|
||||
self::$cookieJar = new CookieJar;
|
||||
@@ -360,17 +366,21 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
$iohandler->set_input('script_path', $parseURL['path']);
|
||||
$iohandler->set_input('submit_server', 'submit');
|
||||
|
||||
do
|
||||
{
|
||||
$installer->run();
|
||||
}
|
||||
while (file_exists($phpbb_root_path . 'store/install_config.php'));
|
||||
$installer->run();
|
||||
|
||||
copy($config_file, $config_file_test);
|
||||
|
||||
self::$install_success = true;
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/install_config.php'))
|
||||
{
|
||||
self::$install_success = false;
|
||||
@unlink($phpbb_root_path . 'store/install_config.php');
|
||||
}
|
||||
|
||||
if (file_exists($phpbb_root_path . 'cache/install_lock'))
|
||||
{
|
||||
unlink($phpbb_root_path . 'cache/install_lock');
|
||||
@unlink($phpbb_root_path . 'cache/install_lock');
|
||||
}
|
||||
|
||||
global $phpbb_container, $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log, $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template;
|
||||
|
@@ -31,6 +31,8 @@ class phpbb_ui_test_case extends phpbb_test_case
|
||||
static protected $config;
|
||||
static protected $root_url;
|
||||
static protected $already_installed = false;
|
||||
static protected $install_success = false;
|
||||
static protected $db;
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
@@ -79,6 +81,25 @@ class phpbb_ui_test_case extends phpbb_test_case
|
||||
}
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!self::$install_success)
|
||||
{
|
||||
$this->fail('Installing phpBB has failed.');
|
||||
}
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
if (self::$db instanceof \phpbb\db\driver\driver_interface)
|
||||
{
|
||||
// Close the database connections again this test
|
||||
self::$db->sql_close();
|
||||
}
|
||||
}
|
||||
|
||||
static public function visit($path)
|
||||
{
|
||||
self::$webDriver->get(self::$root_url . $path);
|
||||
@@ -103,10 +124,12 @@ class phpbb_ui_test_case extends phpbb_test_case
|
||||
|
||||
static public function install_board()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
global $phpbb_root_path, $phpEx, $db;
|
||||
|
||||
self::recreate_database(self::$config);
|
||||
|
||||
$db = self::get_db();
|
||||
|
||||
$config_file = $phpbb_root_path . "config.$phpEx";
|
||||
$config_file_dev = $phpbb_root_path . "config_dev.$phpEx";
|
||||
$config_file_test = $phpbb_root_path . "config_test.$phpEx";
|
||||
@@ -199,21 +222,40 @@ class phpbb_ui_test_case extends phpbb_test_case
|
||||
$iohandler->set_input('script_path', $parseURL['path']);
|
||||
$iohandler->set_input('submit_server', 'submit');
|
||||
|
||||
do
|
||||
{
|
||||
$installer->run();
|
||||
}
|
||||
while (file_exists($phpbb_root_path . 'store/install_config.php'));
|
||||
$installer->run();
|
||||
|
||||
copy($config_file, $config_file_test);
|
||||
|
||||
self::$install_success = true;
|
||||
|
||||
if (file_exists($phpbb_root_path . 'store/install_config.php'))
|
||||
{
|
||||
self::$install_success = false;
|
||||
@unlink($phpbb_root_path . 'store/install_config.php');
|
||||
}
|
||||
|
||||
if (file_exists($phpbb_root_path . 'cache/install_lock'))
|
||||
{
|
||||
unlink($phpbb_root_path . 'cache/install_lock');
|
||||
@unlink($phpbb_root_path . 'cache/install_lock');
|
||||
}
|
||||
|
||||
global $phpbb_container, $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log, $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template;
|
||||
$phpbb_container->reset();
|
||||
unset($phpbb_container, $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log, $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template);
|
||||
}
|
||||
|
||||
static protected function get_db()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
// so we don't reopen an open connection
|
||||
if (!(self::$db instanceof \phpbb\db\driver\driver_interface))
|
||||
{
|
||||
$dbms = self::$config['dbms'];
|
||||
/** @var \phpbb\db\driver\driver_interface $db */
|
||||
$db = new $dbms();
|
||||
$db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']);
|
||||
self::$db = $db;
|
||||
}
|
||||
return self::$db;
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
class quick_links_test extends phpbb_ui_test_case
|
||||
{
|
||||
|
||||
public function test_quick_links()
|
||||
{
|
||||
$this->visit('index.php');
|
||||
|
Reference in New Issue
Block a user