Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove DB files after tests #9192

Open
wants to merge 1 commit into
base: 4.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/system/Database/Live/ForgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@
$this->assertFalse($result);

$db->close();

if ($this->db->DBDriver !== 'SQLite3') {
$this->forge->dropDatabase($dbName);
} elseif (is_file($db->database)) {
unlink($db->database);
}
}

Expand Down Expand Up @@ -488,7 +491,7 @@
$this->forge->dropTable('', true);
}

public function testForeignKey(): void

Check warning on line 494 in tests/system/Database/Live/ForgeTest.php

View workflow job for this annotation

GitHub Actions / DatabaseLive (8.2, OCI8, 8.0) / tests

Took 2.7755s from 0.5000s limit to run CodeIgniter\\Database\\Live\\ForgeTest::testForeignKey
{
$this->forge->dropTable('forge_test_invoices', true);
$this->forge->dropTable('forge_test_users', true);
Expand Down Expand Up @@ -1230,7 +1233,7 @@
$this->forge->dropTable('forge_test_1', true);
}

public function testSetKeyNames(): void

Check warning on line 1236 in tests/system/Database/Live/ForgeTest.php

View workflow job for this annotation

GitHub Actions / DatabaseLive (8.2, OCI8, 8.0) / tests

Took 1.0099s from 0.5000s limit to run CodeIgniter\\Database\\Live\\ForgeTest::testSetKeyNames
{
$this->forge->dropTable('forge_test_1', true);

Expand Down Expand Up @@ -1578,7 +1581,7 @@
$this->forge->dropTable('forge_test_four', true);
}

public function testDropKey(): void

Check warning on line 1584 in tests/system/Database/Live/ForgeTest.php

View workflow job for this annotation

GitHub Actions / DatabaseLive (8.2, OCI8, 8.0) / tests

Took 0.8000s from 0.5000s limit to run CodeIgniter\\Database\\Live\\ForgeTest::testDropKey
{
$this->forge->dropTable('key_test_users', true);
$keyName = 'key_test_users_id';
Expand Down Expand Up @@ -1665,7 +1668,7 @@
$this->forge->dropTable('forge_test_users', true);
}

public function testProcessIndexes(): void

Check warning on line 1671 in tests/system/Database/Live/ForgeTest.php

View workflow job for this annotation

GitHub Actions / DatabaseLive (8.2, OCI8, 8.0) / tests

Took 1.4123s from 0.5000s limit to run CodeIgniter\\Database\\Live\\ForgeTest::testProcessIndexes
{
// make sure tables don't exist
$this->forge->dropTable('actions', true);
Expand Down
9 changes: 9 additions & 0 deletions tests/system/Database/Live/SQLite3/GetIndexDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ protected function setUp(): void
$this->forge = Database::forge($config);
}

protected function tearDown(): void
{
parent::tearDown();

if ($this->db->DBDriver === 'SQLite3' && is_file($this->db->database)) {
unlink($this->db->database);
}
}

public function testGetIndexData(): void
{
// INTEGER PRIMARY KEY AUTO_INCREMENT doesn't get an index by default
Expand Down
Loading