Проблема с лимитом подключений к базе в тестах решилась добавлением $this->entityManager->getConnection()->close(); в tearDown()
/**
* @throws ConnectionException
*/
public function tearDown(): void
{
parent::tearDown();
// ...
$this->entityManager->getConnection()->close();
}
Забавно, что в официальной документации (с.м. последний пример):
https://symfony.com/doc/current/testing/database.html
Указано:
protected function tearDown(): void
{
parent::tearDown();
// doing this is recommended to avoid memory leaks
$this->entityManager->close();
$this->entityManager = null;
}
Что, по факту, не помогало решить проблему с лимитом подключений.