1414namespace CodeIgniter \Commands ;
1515
1616use CodeIgniter \Database \BaseConnection ;
17- use CodeIgniter \Database \Database as DatabaseFactory ;
1817use CodeIgniter \Database \OCI8 \Connection as OCI8Connection ;
1918use CodeIgniter \Database \SQLite3 \Connection as SQLite3Connection ;
2019use CodeIgniter \Test \CIUnitTestCase ;
@@ -51,15 +50,14 @@ protected function tearDown(): void
5150 private function dropDatabase (): void
5251 {
5352 if ($ this ->connection instanceof SQLite3Connection) {
54- $ file = WRITEPATH . 'foobar.db ' ;
53+ $ file = WRITEPATH . 'database.db ' ;
54+
5555 if (is_file ($ file )) {
5656 unlink ($ file );
5757 }
5858 } else {
59- $ util = (new DatabaseFactory ())->loadUtils ($ this ->connection );
60-
61- if ($ util ->databaseExists ('foobar ' )) {
62- Database::forge ()->dropDatabase ('foobar ' );
59+ if (Database::utils ('tests ' )->databaseExists ('database ' )) {
60+ Database::forge ()->dropDatabase ('database ' );
6361 }
6462 }
6563 }
@@ -75,7 +73,7 @@ public function testCreateDatabase(): void
7573 $ this ->markTestSkipped ('Needs to run on non-OCI8 drivers. ' );
7674 }
7775
78- command ('db:create foobar ' );
76+ command ('db:create database ' );
7977 $ this ->assertStringContainsString ('successfully created. ' , $ this ->getBuffer ());
8078 }
8179
@@ -85,10 +83,10 @@ public function testSqliteDatabaseDuplicated(): void
8583 $ this ->markTestSkipped ('Needs to run on SQLite3. ' );
8684 }
8785
88- command ('db:create foobar ' );
86+ command ('db:create database ' );
8987 $ this ->resetStreamFilterBuffer ();
9088
91- command ('db:create foobar --ext db ' );
89+ command ('db:create database --ext db ' );
9290 $ this ->assertStringContainsString ('already exists. ' , $ this ->getBuffer ());
9391 }
9492
@@ -98,10 +96,10 @@ public function testOtherDriverDuplicatedDatabase(): void
9896 $ this ->markTestSkipped ('Needs to run on non-SQLite3 and non-OCI8 drivers. ' );
9997 }
10098
101- command ('db:create foobar ' );
99+ command ('db:create database ' );
102100 $ this ->resetStreamFilterBuffer ();
103101
104- command ('db:create foobar ' );
102+ command ('db:create database ' );
105103 $ this ->assertStringContainsString ('Unable to create the specified database. ' , $ this ->getBuffer ());
106104 }
107105}
0 commit comments