Skip to content

Commit

Permalink
[9.x] Allow cleanup of databases when using parallel tests (#41806)
Browse files Browse the repository at this point in the history
* feat: allow cleanup up of created databases in parallel tests

* Update TestDatabases.php

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
abenerd and taylorotwell authored Apr 4, 2022
1 parent 8c213be commit 2f44032
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Illuminate/Testing/Concerns/TestDatabases.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ protected function bootTestDatabase()
});
}
});

ParallelTesting::tearDownProcess(function () {
$this->whenNotUsingInMemoryDatabase(function ($database) {
if (ParallelTesting::option('drop_databases')) {
Schema::dropDatabaseIfExists(
$this->testDatabase($database)
);
}
});
});
}

/**
Expand Down

0 comments on commit 2f44032

Please sign in to comment.