File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -134,9 +134,9 @@ public static function Database(): array
134134
135135 // Under GitHub Actions, we can set an ENV var named 'DB'
136136 // so that we can test against multiple databases.
137- if (( $ group = getenv ('DB ' )) && isset ( self :: $ dbConfig [ $ group ])) {
138- $ config [ ' tests ' ] = self :: $ dbConfig [ $ group ];
139- }
137+ $ group = env ('DB ' , ' SQLite3 ' );
138+
139+ $ config [ ' tests ' ] = self :: $ dbConfig [ $ group ] ?? [];
140140
141141 return $ config ;
142142 }
Original file line number Diff line number Diff line change 1515
1616use CodeIgniter \CLI \CLI ;
1717use CodeIgniter \Test \CIUnitTestCase ;
18+ use CodeIgniter \Test \DatabaseTestTrait ;
1819use CodeIgniter \Test \StreamFilterTrait ;
1920use Config \Database ;
2021use PHPUnit \Framework \Attributes \Group ;
2627final class MigrateStatusTest extends CIUnitTestCase
2728{
2829 use StreamFilterTrait;
30+ use DatabaseTestTrait;
2931
3032 private string $ migrationFileFrom = SUPPORTPATH . 'MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php ' ;
3133 private string $ migrationFileTo = APPPATH . 'Database/Migrations/2018-01-24-102301_Some_migration.php ' ;
3234
3335 protected function setUp (): void
3436 {
35- $ forge = Database::forge ();
36- $ forge ->dropTable ('foo ' , true );
37-
3837 parent ::setUp ();
3938
39+ Database::connect ()->table ('migrations ' )->emptyTable ();
40+ Database::forge ()->dropTable ('foo ' , true );
41+
4042 if (! is_file ($ this ->migrationFileFrom )) {
4143 $ this ->fail (clean_path ($ this ->migrationFileFrom ) . ' is not found. ' );
4244 }
@@ -63,8 +65,7 @@ protected function tearDown(): void
6365 {
6466 parent ::tearDown ();
6567
66- $ db = db_connect ();
67- $ db ->table ('migrations ' )->emptyTable ();
68+ Database::connect ()->table ('migrations ' )->emptyTable ();
6869
6970 if (is_file ($ this ->migrationFileTo )) {
7071 @unlink ($ this ->migrationFileTo );
You can’t perform that action at this time.
0 commit comments