-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Closed
Description
- Laravel Version: 5.4.16
- PHP Version: 7.1
- Database Driver & Version: MySQL
Description:
I have a test suite which now has 140 tests. Each of my tests uses the DatabaseMigrations trait along with a dedicated database solely for tests to run against.
When PHP Unit gets to the last test it fails with the following error:
Caused by
Doctrine\DBAL\Driver\PDOException: SQLSTATE[08004] [1040] Too many connections
I can run this test individually and it passes fine.
After finding this issue (#10619 (comment)) I tried the following but the problem still persists:
- Added the
PDO::ATTR_PERSISTENT => falseoption to my test database connection entry - Added the following code to the DatabaseMigrations trait:
$this->beforeApplicationDestroyed(function () {
$this->artisan('migrate:rollback');
foreach ($this->app->make('db')->getConnections() as $connection) {
$connection->disconnect();
}
});Steps To Reproduce:
N/A
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels