From e9157f4d10f96f5d921ede7c87a101475b1e611f Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 1 Jul 2025 16:12:06 +0700 Subject: [PATCH] [ticket/17525] Fix tests PHPBB-17525 --- phpBB/phpbb/db/tools/doctrine.php | 2 +- phpBB/phpbb/db/tools/tools_interface.php | 7 +++++++ tests/dbal/migrator_test.php | 7 ++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/db/tools/doctrine.php b/phpBB/phpbb/db/tools/doctrine.php index f74f251712..a190e1f319 100644 --- a/phpBB/phpbb/db/tools/doctrine.php +++ b/phpBB/phpbb/db/tools/doctrine.php @@ -62,7 +62,7 @@ class doctrine implements tools_interface } /** - * @return Connection + * {@inheritDoc} */ public function get_connection(): Connection { diff --git a/phpBB/phpbb/db/tools/tools_interface.php b/phpBB/phpbb/db/tools/tools_interface.php index 09f47ed566..e8c23a5109 100644 --- a/phpBB/phpbb/db/tools/tools_interface.php +++ b/phpBB/phpbb/db/tools/tools_interface.php @@ -226,4 +226,11 @@ interface tools_interface * @return void */ public function sql_truncate_table(string $table_name): void; + + /** + * Gets current Doctrine DBAL connection + * + * @return \Doctrine\DBAL\Connection + */ + public function get_connection(): \Doctrine\DBAL\Connection; } diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index e7fbd4eb2d..4207e388de 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -485,9 +485,10 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $this->assertNotEmpty($table_keys); - $short_table_names = \phpbb\db\doctrine\table_helper::map_short_table_names(['custom_table' => 'cstmtbl'], 'phpbb_'); - $this->assertEquals('phpbb_custom_table', array_search('cstmtbl', $short_table_names)); - $this->assertEquals($short_table_names['phpbb_custom_table'], 'cstmtbl'); + $table_names = array_merge(array_keys($db_table_schema), ['phpbb_custom_table']); + $short_table_names = \phpbb\db\doctrine\table_helper::map_short_table_names($table_names, 'phpbb_'); + $this->assertEquals('phpbb_custom_table', array_search(\phpbb\db\doctrine\table_helper::generate_shortname('custom_table'), $short_table_names)); + $this->assertEquals($short_table_names['phpbb_custom_table'], \phpbb\db\doctrine\table_helper::generate_shortname('custom_table')); foreach ($table_keys as $table_name => $key_names) {