File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
tests/system/Database/Migrations Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,32 @@ public function testGetBatchVersions(): void
454454 $ this ->assertSame ('2018-01-24-102302 ' , $ runner ->getBatchEnd (1 ));
455455 }
456456
457+ /**
458+ * @runInSeparateProcess
459+ * @preserveGlobalState disabled
460+ */
461+ public function testMigrationUsesSameConnectionAsMigrationRunner (): void
462+ {
463+ $ config = ['database ' => WRITEPATH . 'runner.sqlite ' , 'DBDriver ' => 'SQLite3 ' , 'DBDebug ' => true ];
464+
465+ if (is_file ($ config ['database ' ])) {
466+ unlink ($ config ['database ' ]);
467+ }
468+
469+ $ database = Database::connect ($ config , false );
470+
471+ $ runner = new MigrationRunner (config (Migrations::class), $ database );
472+ $ runner ->clearCliMessages ();
473+ $ runner ->clearHistory ();
474+ $ runner ->setNamespace ('Tests\Support\MigrationTestMigrations ' );
475+ $ runner ->latest ();
476+
477+ $ tables = $ database ->listTables ();
478+ $ this ->assertCount (2 , $ tables );
479+ $ this ->assertSame ('migrations ' , $ tables [0 ]);
480+ $ this ->assertSame ('foo ' , $ tables [1 ]);
481+ }
482+
457483 protected function resetTables (): void
458484 {
459485 $ forge = Config::forge ();
You can’t perform that action at this time.
0 commit comments