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,16 +50,13 @@ 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 }
58- } else {
59- $ util = (new DatabaseFactory ())->loadUtils ($ this ->connection );
60-
61- if ($ util ->databaseExists ('foobar ' )) {
62- Database::forge ()->dropDatabase ('foobar ' );
63- }
58+ } elseif (Database::utils ('tests ' )->databaseExists ('database ' )) {
59+ Database::forge ()->dropDatabase ('database ' );
6460 }
6561 }
6662
@@ -75,7 +71,7 @@ public function testCreateDatabase(): void
7571 $ this ->markTestSkipped ('Needs to run on non-OCI8 drivers. ' );
7672 }
7773
78- command ('db:create foobar ' );
74+ command ('db:create database ' );
7975 $ this ->assertStringContainsString ('successfully created. ' , $ this ->getBuffer ());
8076 }
8177
@@ -85,10 +81,10 @@ public function testSqliteDatabaseDuplicated(): void
8581 $ this ->markTestSkipped ('Needs to run on SQLite3. ' );
8682 }
8783
88- command ('db:create foobar ' );
84+ command ('db:create database ' );
8985 $ this ->resetStreamFilterBuffer ();
9086
91- command ('db:create foobar --ext db ' );
87+ command ('db:create database --ext db ' );
9288 $ this ->assertStringContainsString ('already exists. ' , $ this ->getBuffer ());
9389 }
9490
@@ -98,10 +94,10 @@ public function testOtherDriverDuplicatedDatabase(): void
9894 $ this ->markTestSkipped ('Needs to run on non-SQLite3 and non-OCI8 drivers. ' );
9995 }
10096
101- command ('db:create foobar ' );
97+ command ('db:create database ' );
10298 $ this ->resetStreamFilterBuffer ();
10399
104- command ('db:create foobar ' );
100+ command ('db:create database ' );
105101 $ this ->assertStringContainsString ('Unable to create the specified database. ' , $ this ->getBuffer ());
106102 }
107103}
0 commit comments