1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/17525] Address the PR review comments

PHPBB-17525
This commit is contained in:
rxu
2025-07-05 12:27:10 +07:00
parent 10921ebc58
commit aa3f266b8c
13 changed files with 48 additions and 54 deletions

View File

@@ -25,7 +25,7 @@ class phpbb_captcha_qa_test extends \phpbb_database_test_case
protected function setUp(): void
{
global $db, $request, $phpbb_container, $table_prefix;
global $db, $request, $phpbb_container;
$db = $this->new_dbal();
$db_doctrine = $this->new_doctrine_dbal();
@@ -35,9 +35,7 @@ class phpbb_captcha_qa_test extends \phpbb_database_test_case
$request = new \phpbb_mock_request();
$phpbb_container = new \phpbb_mock_container_builder();
$factory = new \phpbb\db\tools\factory();
$db_tools = $factory->get($db_doctrine);
$db_tools->set_table_prefix($table_prefix);
$phpbb_container->set('dbal.tools', $db_tools);
$phpbb_container->set('dbal.tools', $factory->get($db_doctrine));
$this->qa = new \phpbb\captcha\plugins\qa('phpbb_captcha_questions', 'phpbb_captcha_answers', 'phpbb_qa_confirm');
}

View File

@@ -32,7 +32,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
protected function setUp(): void
{
global $auth, $db, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx, $table_prefix;
global $auth, $db, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new \phpbb\event\dispatcher();
$phpbb_container = new phpbb_mock_container_builder();
@@ -141,7 +141,6 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$factory = new \phpbb\db\tools\factory();
$db_doctrine = $this->new_doctrine_dbal();
$db_tools = $factory->get($db_doctrine);
$db_tools->set_table_prefix($table_prefix);
$migrator = new \phpbb\db\migrator(
$phpbb_container,
$config,

View File

@@ -26,10 +26,9 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case
protected function setUp(): void
{
global $table_prefix;
parent::setUp();
$table_prefix = 'prefix_';
$this->db = $this->new_dbal();
$this->db_doctrine = $this->new_doctrine_dbal();
$factory = new \phpbb\db\tools\factory();

View File

@@ -18,13 +18,10 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
public function getDataSet()
{
global $table_prefix;
$this->db = $this->new_dbal();
$this->db_doctrine = $this->new_doctrine_dbal();
$factory = new \phpbb\db\tools\factory();
$db_tools = $factory->get($this->db_doctrine);
$db_tools->set_table_prefix($table_prefix);
// user_dst doesn't exist anymore, must re-add it to test this
$db_tools->sql_column_add('phpbb_users', 'user_dst', array('BOOL', 1));
@@ -58,18 +55,16 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
{
parent::setUp();
global $phpbb_root_path, $phpEx, $table_prefix;
global $phpbb_root_path, $phpEx;
$this->db = $this->new_dbal();
$this->db_doctrine = $this->new_doctrine_dbal();
$factory = new \phpbb\db\tools\factory();
$db_tools = $factory->get($this->db_doctrine);
$db_tools->set_table_prefix($table_prefix);
$this->migration = new \phpbb\db\migration\data\v310\timezone(
new \phpbb\config\config(array()),
$this->db,
$db_tools,
$factory->get($this->db_doctrine),
$phpbb_root_path,
$phpEx,
'phpbb_',
@@ -89,8 +84,6 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
public function test_convert()
{
global $table_prefix;
$this->migration->update_timezones(0);
$sql = 'SELECT user_id, user_timezone
@@ -105,7 +98,6 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
$factory = new \phpbb\db\tools\factory();
$db_tools = $factory->get($this->db_doctrine);
$db_tools->set_table_prefix($table_prefix);
// Remove the user_dst field again
$db_tools->sql_column_remove('phpbb_users', 'user_dst');

View File

@@ -25,13 +25,12 @@ class phpbb_notification_convert_test extends phpbb_database_test_case
{
parent::setUp();
global $phpbb_root_path, $phpEx, $table_prefix;
global $phpbb_root_path, $phpEx;
$this->db = $this->new_dbal();
$this->doctrine_db = $this->new_doctrine_dbal();
$factory = new \phpbb\db\tools\factory();
$db_tools = $factory->get($this->doctrine_db);
$db_tools->set_table_prefix($table_prefix);
$core_tables = self::get_core_tables();
// Add user_notify_type column for testing this migration and set type

View File

@@ -25,7 +25,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
protected function setUp(): void
{
global $phpbb_root_path, $phpEx, $config, $cache, $table_prefix;
global $phpbb_root_path, $phpEx, $config, $cache;
parent::setUp();
@@ -41,7 +41,6 @@ class phpbb_search_native_test extends phpbb_search_test_case
$this->db = $this->new_dbal();
$tools_factory = new \phpbb\db\tools\factory();
$this->db_tools = $tools_factory->get($this->new_doctrine_dbal());
$this->db_tools->set_table_prefix($table_prefix);
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native');
$config['fulltext_native_min_chars'] = 2;