Skip to content

Commit 73aca90

Browse files
committed
add testCreateDatabaseIfNotExists and testCreateDatabaseIfNotExistsWithDb
1 parent bfbb35b commit 73aca90

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/system/Database/Live/ForgeTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@ public function testCreateDatabase()
3030
$this->assertTrue($database_created);
3131
}
3232

33+
public function testCreateDatabaseIfNotExists()
34+
{
35+
$dbName = 'test_forge_database_exist';
36+
37+
$databaseCreateIfNotExists = $this->forge->createDatabase($dbName, true);
38+
$this->forge->dropDatabase($dbName);
39+
40+
$this->assertTrue($databaseCreateIfNotExists);
41+
}
42+
43+
public function testCreateDatabaseIfNotExistsWithDb()
44+
{
45+
$dbName = 'test_forge_database_exist';
46+
47+
$this->forge->createDatabase($dbName);
48+
$databaseExists = $this->forge->createDatabase($dbName, true);
49+
$this->forge->dropDatabase($dbName);
50+
51+
$this->assertTrue($databaseExists);
52+
}
53+
3354
public function testDropDatabase()
3455
{
3556
if ($this->db->DBDriver === 'SQLite3')

0 commit comments

Comments
 (0)