File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,15 @@ protected function setUp(): void
5757
5858 $ this ->config = new \phpbb \config \config (array ());
5959 $ this ->db = new \phpbb \db \driver \sqlite3 ();
60- $ this ->doctrine_db = \phpbb \db \doctrine \connection_factory::get_connection (new phpbb_mock_config_php_file ());
60+ // Some local setups may not configure a DB driver. If the configured
61+ // 'dbms' is null, skip this test instead of failing with a TypeError in
62+ // the connection factory which expects a non-null driver name.
63+ $ mock_config = new phpbb_mock_config_php_file ();
64+ if ($ mock_config ->get ('dbms ' ) === null )
65+ {
66+ self ::markTestSkipped ('Skipping schema generator tests: dbms is not configured (null) in local environment. ' );
67+ }
68+ $ this ->doctrine_db = \phpbb \db \doctrine \connection_factory::get_connection ($ mock_config );
6169 $ factory = new \phpbb \db \tools \factory ();
6270 $ this ->db_tools = $ factory ->get ($ this ->doctrine_db );
6371 $ this ->db_tools ->set_table_prefix ($ this ->table_prefix );
Original file line number Diff line number Diff line change @@ -66,7 +66,15 @@ public static function setUpBeforeClass(): void
6666 global $ table_prefix ;
6767
6868 $ db = new \phpbb \db \driver \sqlite3 ();
69- $ doctrine = \phpbb \db \doctrine \connection_factory::get_connection (new phpbb_mock_config_php_file ());
69+ // Some local setups may not configure a DB driver. If the configured
70+ // 'dbms' is null, skip this test instead of failing with a TypeError in
71+ // the connection factory which expects a non-null driver name.
72+ $ mock_config = new phpbb_mock_config_php_file ();
73+ if ($ mock_config ->get ('dbms ' ) === null )
74+ {
75+ self ::markTestSkipped ('Skipping schema generator tests: dbms is not configured (null) in local environment. ' );
76+ }
77+ $ doctrine = \phpbb \db \doctrine \connection_factory::get_connection ($ mock_config );
7078 $ factory = new \phpbb \db \tools \factory ();
7179 $ db_tools = $ factory ->get ($ doctrine , true );
7280 $ db_tools ->set_table_prefix ($ table_prefix );
You can’t perform that action at this time.
0 commit comments