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,15 +50,14 @@ 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
58
} 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 ' );
63
61
}
64
62
}
65
63
}
@@ -75,7 +73,7 @@ public function testCreateDatabase(): void
75
73
$ this ->markTestSkipped ('Needs to run on non-OCI8 drivers. ' );
76
74
}
77
75
78
- command ('db:create foobar ' );
76
+ command ('db:create database ' );
79
77
$ this ->assertStringContainsString ('successfully created. ' , $ this ->getBuffer ());
80
78
}
81
79
@@ -85,10 +83,10 @@ public function testSqliteDatabaseDuplicated(): void
85
83
$ this ->markTestSkipped ('Needs to run on SQLite3. ' );
86
84
}
87
85
88
- command ('db:create foobar ' );
86
+ command ('db:create database ' );
89
87
$ this ->resetStreamFilterBuffer ();
90
88
91
- command ('db:create foobar --ext db ' );
89
+ command ('db:create database --ext db ' );
92
90
$ this ->assertStringContainsString ('already exists. ' , $ this ->getBuffer ());
93
91
}
94
92
@@ -98,10 +96,10 @@ public function testOtherDriverDuplicatedDatabase(): void
98
96
$ this ->markTestSkipped ('Needs to run on non-SQLite3 and non-OCI8 drivers. ' );
99
97
}
100
98
101
- command ('db:create foobar ' );
99
+ command ('db:create database ' );
102
100
$ this ->resetStreamFilterBuffer ();
103
101
104
- command ('db:create foobar ' );
102
+ command ('db:create database ' );
105
103
$ this ->assertStringContainsString ('Unable to create the specified database. ' , $ this ->getBuffer ());
106
104
}
107
105
}
0 commit comments