Skip to content

Commit 30bfaa3

Browse files
committed
test: ensure cleanup of sqlite3 db files after test
1 parent d72a893 commit 30bfaa3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tests/system/Database/Live/SQLite3/GetIndexDataTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,19 @@ protected function setUp(): void
4545
'database' => 'database.db',
4646
'DBDebug' => true,
4747
];
48-
$this->db = db_connect($config);
48+
$this->db = db_connect($config, false);
4949
$this->forge = Database::forge($config);
5050
}
5151

52+
protected function tearDown(): void
53+
{
54+
parent::tearDown();
55+
56+
if (is_file(WRITEPATH . 'database.db')) {
57+
unlink(WRITEPATH . 'database.db');
58+
}
59+
}
60+
5261
public function testGetIndexData(): void
5362
{
5463
// INTEGER PRIMARY KEY AUTO_INCREMENT doesn't get an index by default

tests/system/Database/Migrations/MigrationRunnerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,10 @@ public function testMigrationUsesSameConnectionAsMigrationRunner(): void
470470
$this->assertCount(2, $tables);
471471
$this->assertSame('migrations', $tables[0]);
472472
$this->assertSame('foo', $tables[1]);
473+
474+
if (is_file($config['database'])) {
475+
unlink($config['database']);
476+
}
473477
}
474478

475479
protected function resetTables($db = null): void

0 commit comments

Comments
 (0)