Open gianiaz opened 1 month ago
Indeed I'm aware of this issue although I never saw it happening in practice so far. I will see if I find the time to look into this.
Hi @dmaicher , don't know if this is the best way to achieve the result, but we put in an abstract teardown this assertion:
protected function tearDown(): void
{
$em = $this->getContainer()->get(EntityManagerInterface::class);
$connection = $em->getConnection();
$this->assertLessThanOrEqual(
1,
$connection->getTransactionNestingLevel(),
'Begin transaction not closed'
);
parent::tearDown();
}
Assuming that:
A small suggestion: you shouldn't do that in the tearDown
method, but in the assertPostConditions
method, which is the correct one, since it's executed just after the test method, and (more importantly) before the test outcome is finalized.
Hi, we have just faced a bug in our application because we forgot to commit a transaction.
Our tests were green, and I'm wondering if the bundle should have warned us, or if at least should give us some sort of utility to assert that all beginTransaction has been followed with either a rollback or a commit.
Thank you