Skip to content

Commit 2f44032

Browse files
[9.x] Allow cleanup of databases when using parallel tests (#41806)
* feat: allow cleanup up of created databases in parallel tests * Update TestDatabases.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent 8c213be commit 2f44032

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Illuminate/Testing/Concerns/TestDatabases.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ protected function bootTestDatabase()
6161
});
6262
}
6363
});
64+
65+
ParallelTesting::tearDownProcess(function () {
66+
$this->whenNotUsingInMemoryDatabase(function ($database) {
67+
if (ParallelTesting::option('drop_databases')) {
68+
Schema::dropDatabaseIfExists(
69+
$this->testDatabase($database)
70+
);
71+
}
72+
});
73+
});
6474
}
6575

6676
/**

0 commit comments

Comments
 (0)