1212namespace CodeIgniter \Commands ;
1313
1414use CodeIgniter \Database \BaseConnection ;
15- use CodeIgniter \Database \SQLite3 \Connection ;
15+ use CodeIgniter \Database \SQLite3 \Connection as SQLite3Connection ;
1616use CodeIgniter \Test \CIUnitTestCase ;
1717use CodeIgniter \Test \Filters \CITestStreamFilter ;
1818use Config \Database ;
@@ -39,9 +39,13 @@ protected function setUp(): void
3939
4040 parent ::setUp ();
4141
42- $ file = WRITEPATH . 'foobar.db ' ;
43- if (file_exists ($ file )) {
44- unlink ($ file );
42+ if ($ this ->connection instanceof SQLite3Connection) {
43+ $ file = WRITEPATH . 'foobar.db ' ;
44+ if (file_exists ($ file )) {
45+ unlink ($ file );
46+ }
47+ } else {
48+ Database::forge ()->dropDatabase ('foobar ' );
4549 }
4650 }
4751
@@ -65,7 +69,7 @@ public function testCreateDatabase()
6569
6670 public function testSqliteDatabaseDuplicated ()
6771 {
68- if (! $ this ->connection instanceof Connection ) {
72+ if (! $ this ->connection instanceof SQLite3Connection ) {
6973 $ this ->markTestSkipped ('Needs to run on SQLite3. ' );
7074 }
7175
@@ -78,7 +82,7 @@ public function testSqliteDatabaseDuplicated()
7882
7983 public function testOtherDriverDuplicatedDatabase ()
8084 {
81- if ($ this ->connection instanceof Connection ) {
85+ if ($ this ->connection instanceof SQLite3Connection ) {
8286 $ this ->markTestSkipped ('Needs to run on non-SQLite3 drivers. ' );
8387 }
8488
0 commit comments