After terminating a phpunit test in Laravel 5.1 midway I'm now getting the following PDO error:
General error: 2014 Cannot execute queries while other unbuffered queries are active
This happens every time I try to run the same test. Commenting out use DatabaseTransactions;
in the test class fixes the issue but I don't want my live database to be populated with test data. I tried setting the PDO attribute PDO::MYSQL_ATTR_USE_BUFFERED_QUERY to true as suggested using this code:
$pdo = DB::connection()->getPdo();
$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, TRUE);
but that didn't fix the issue either.
The question Causes of MySQL error 2014 Cannot execute queries while other unbuffered queries are active suggests changing the PDO statements themselves but I don't know how to do that using Eloquent without editing the Laravel source.
Is there anyway to get around this without having to restart the MySQL server and still be able to use the DatabaseTransactions trait that Laravel provides?