Closed PNixx closed 1 year ago
AsyncTestCase will use a separate event loop per test for isolation purposes, but that makes previous watchers invalid that are still supposed to be active in global state. We've removed swapping the event loop instance in the new major version for that reason.
Do I need to connect to the DB every time I run a test? This is terrible.
Currently, that's how it is when using AsyncTestCase
, yes.
The event loop is no longer discarded between each test in AMPHP v3 and therefore in v2.x of this library, so this should no longer be an issue.
That being said, be careful about sharing state between test and that you're doing it intentionally, not accidentally.
I try use PHPUnit with Postgres adapter. But I catch error.
amphp/postgres v1.4.3
Example code:Test log:
But for this example, tests works correctly:
Log: