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
134
134
135
135
// Under GitHub Actions, we can set an ENV var named 'DB'
136
136
// 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 ] ?? [];
140
140
141
141
return $ config ;
142
142
}
Original file line number Diff line number Diff line change 15
15
16
16
use CodeIgniter \CLI \CLI ;
17
17
use CodeIgniter \Test \CIUnitTestCase ;
18
+ use CodeIgniter \Test \DatabaseTestTrait ;
18
19
use CodeIgniter \Test \StreamFilterTrait ;
19
20
use Config \Database ;
20
21
use PHPUnit \Framework \Attributes \Group ;
26
27
final class MigrateStatusTest extends CIUnitTestCase
27
28
{
28
29
use StreamFilterTrait;
30
+ use DatabaseTestTrait;
29
31
30
32
private string $ migrationFileFrom = SUPPORTPATH . 'MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php ' ;
31
33
private string $ migrationFileTo = APPPATH . 'Database/Migrations/2018-01-24-102301_Some_migration.php ' ;
32
34
33
35
protected function setUp (): void
34
36
{
35
- $ forge = Database::forge ();
36
- $ forge ->dropTable ('foo ' , true );
37
-
38
37
parent ::setUp ();
39
38
39
+ Database::connect ()->table ('migrations ' )->emptyTable ();
40
+ Database::forge ()->dropTable ('foo ' , true );
41
+
40
42
if (! is_file ($ this ->migrationFileFrom )) {
41
43
$ this ->fail (clean_path ($ this ->migrationFileFrom ) . ' is not found. ' );
42
44
}
@@ -63,8 +65,7 @@ protected function tearDown(): void
63
65
{
64
66
parent ::tearDown ();
65
67
66
- $ db = db_connect ();
67
- $ db ->table ('migrations ' )->emptyTable ();
68
+ Database::connect ()->table ('migrations ' )->emptyTable ();
68
69
69
70
if (is_file ($ this ->migrationFileTo )) {
70
71
@unlink ($ this ->migrationFileTo );
You can’t perform that action at this time.
0 commit comments