From c85cd6d0c4946d380065b9f348dc1598bc66ffc6 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 31 Dec 2023 02:19:02 +0800 Subject: [PATCH] test: ensure cleanup of sqlite3 db files after test --- tests/system/Database/Live/SQLite3/GetFieldDataTest.php | 2 +- tests/system/Database/Live/SQLite3/GetIndexDataTest.php | 2 +- tests/system/Database/Migrations/MigrationRunnerTest.php | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/system/Database/Live/SQLite3/GetFieldDataTest.php b/tests/system/Database/Live/SQLite3/GetFieldDataTest.php index 319706a90e53..f2e6b7244511 100644 --- a/tests/system/Database/Live/SQLite3/GetFieldDataTest.php +++ b/tests/system/Database/Live/SQLite3/GetFieldDataTest.php @@ -32,7 +32,7 @@ protected function createForge(): void 'database' => 'database.db', 'DBDebug' => true, ]; - $this->db = db_connect($config); + $this->db = db_connect($config, false); $this->forge = Database::forge($config); } diff --git a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php index cf05b7a7f07b..4fa2a4f31167 100644 --- a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php +++ b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php @@ -45,7 +45,7 @@ protected function setUp(): void 'database' => 'database.db', 'DBDebug' => true, ]; - $this->db = db_connect($config); + $this->db = db_connect($config, false); $this->forge = Database::forge($config); } diff --git a/tests/system/Database/Migrations/MigrationRunnerTest.php b/tests/system/Database/Migrations/MigrationRunnerTest.php index aac42778b9f8..af9fa2a6104f 100644 --- a/tests/system/Database/Migrations/MigrationRunnerTest.php +++ b/tests/system/Database/Migrations/MigrationRunnerTest.php @@ -470,6 +470,10 @@ public function testMigrationUsesSameConnectionAsMigrationRunner(): void $this->assertCount(2, $tables); $this->assertSame('migrations', $tables[0]); $this->assertSame('foo', $tables[1]); + + if (is_file($config['database'])) { + unlink($config['database']); + } } protected function resetTables($db = null): void