dmaicher / doctrine-test-bundle

Symfony bundle to isolate your app's doctrine database tests and improve the test performance
MIT License
1.08k stars 61 forks source link

Is there any way to start and rollback transaction in browser tests? #83

Closed cve closed 5 years ago

cve commented 5 years ago

Hi,

I want to run my behat (chromedriver) tests within transaction and my question is: is that possible for example throught api endpoints?: /api/start-transaction and /api/rollback-transaction

dmaicher commented 5 years ago

This is not so easy to achieve :wink:

If you execute php via a webserver you will get a new mysql connection on every request. So having a "cross-request transaction" is not really supported out-of-the box.

It might be doable with persistent connections? Never looked into it.

https://php.net/manual/en/features.persistent-connections.php

dmaicher commented 5 years ago

Anyway nothing I can fix on this bundle as it has to be supported lower level to have a persistent connection.

cve commented 5 years ago

Thank you for open my eyes on persistent connection :)