14
14
namespace CodeIgniter \Commands ;
15
15
16
16
use CodeIgniter \Database \BaseConnection ;
17
- use CodeIgniter \Database \Database as DatabaseFactory ;
18
17
use CodeIgniter \Database \OCI8 \Connection as OCI8Connection ;
19
18
use CodeIgniter \Database \SQLite3 \Connection as SQLite3Connection ;
20
19
use CodeIgniter \Test \CIUnitTestCase ;
@@ -51,16 +50,13 @@ protected function tearDown(): void
51
50
private function dropDatabase (): void
52
51
{
53
52
if ($ this ->connection instanceof SQLite3Connection) {
54
- $ file = WRITEPATH . 'foobar.db ' ;
53
+ $ file = WRITEPATH . 'database.db ' ;
54
+
55
55
if (is_file ($ file )) {
56
56
unlink ($ file );
57
57
}
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 ' );
64
60
}
65
61
}
66
62
@@ -75,7 +71,7 @@ public function testCreateDatabase(): void
75
71
$ this ->markTestSkipped ('Needs to run on non-OCI8 drivers. ' );
76
72
}
77
73
78
- command ('db:create foobar ' );
74
+ command ('db:create database ' );
79
75
$ this ->assertStringContainsString ('successfully created. ' , $ this ->getBuffer ());
80
76
}
81
77
@@ -85,10 +81,10 @@ public function testSqliteDatabaseDuplicated(): void
85
81
$ this ->markTestSkipped ('Needs to run on SQLite3. ' );
86
82
}
87
83
88
- command ('db:create foobar ' );
84
+ command ('db:create database ' );
89
85
$ this ->resetStreamFilterBuffer ();
90
86
91
- command ('db:create foobar --ext db ' );
87
+ command ('db:create database --ext db ' );
92
88
$ this ->assertStringContainsString ('already exists. ' , $ this ->getBuffer ());
93
89
}
94
90
@@ -98,10 +94,10 @@ public function testOtherDriverDuplicatedDatabase(): void
98
94
$ this ->markTestSkipped ('Needs to run on non-SQLite3 and non-OCI8 drivers. ' );
99
95
}
100
96
101
- command ('db:create foobar ' );
97
+ command ('db:create database ' );
102
98
$ this ->resetStreamFilterBuffer ();
103
99
104
- command ('db:create foobar ' );
100
+ command ('db:create database ' );
105
101
$ this ->assertStringContainsString ('Unable to create the specified database. ' , $ this ->getBuffer ());
106
102
}
107
103
}
0 commit comments