File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5656$ ref = new ReflectionClass (\Doctrine \DBAL \Connection::class);
5757$ db_doctrine = $ ref ->newInstanceWithoutConstructor ();
5858
59+ // Create a mock SchemaManager that returns an empty array for listTableNames()
60+ $ schema_manager_mock = new class extends \Doctrine \DBAL \Schema \SqliteSchemaManager {
61+ public function listTableNames () {
62+ return [];
63+ }
64+
65+ public function __construct ()
66+ {
67+ //parent::__construct($connection, $platform);
68+ }
69+ };
70+
71+ $ schema_manager_factory_mock = new class ($ schema_manager_mock ) implements \Doctrine \DBAL \Schema \SchemaManagerFactory {
72+ private $ schema_manager ;
73+ public function __construct ($ schema_manager ) {
74+ $ this ->schema_manager = $ schema_manager ;
75+ }
76+ public function createSchemaManager ($ connection ): \Doctrine \DBAL \Schema \AbstractSchemaManager
77+ {
78+ return $ this ->schema_manager ;
79+ }
80+ };
81+
82+ $ schema_manager_factory = new \ReflectionProperty ($ db_doctrine , 'schemaManagerFactory ' );
83+ $ schema_manager_factory ->setAccessible (true );
84+ $ schema_manager_factory ->setValue ($ db_doctrine , new $ schema_manager_factory_mock ($ schema_manager_mock ));
85+
5986$ factory = new \phpbb \db \tools \factory ();
6087$ db_tools = $ factory ->get ($ db_doctrine , true );
6188$ db_tools ->set_table_prefix ($ table_prefix );
You can’t perform that action at this time.
0 commit comments