Hey everyone, I recently encountered an error on a...
# docker
b
Hey everyone, I recently encountered an error on a simple test scenario. I tried to test the functionality of a zed facade. Exposing it through the zed ui, the facade works and returns my data, but calling it from the test, i get the following error.
Copy code
[Propel\Runtime\Exception\RuntimeException] No connection defined for database "zed". Did you forget to define a connection or is it wrong written?
In both cases the databuilderTransferObject and the normal TransferObject have the same content. Test process:
Copy code
docker/sdk testing codecept build
docker/sdk testing console cache:class-resolver:build
docker/sdk testing console code:test
i
Hi. The possible solution might be - you need to use either
ConnectionHelper
or
TransactionHelper
. Those are responsible for DB connection in tests.
b
But the test doesn't use the db connection, the error comes from the zed facade. The test just calls the facade and checks if the return value is the expected value. The error gets thrown in the zed module while getting an entity from the db. Do is still need the other helpers for the test?
i
Yes, you do need one of them anyway. The thing is, when the tests bootstrap, they are not using the original Zed bootstrap, thus they do not have the application plugins that provide the DB connection. You need the helper to do that for you.
b
Ok now i get "Unable to open Connection" from the PropelConnectionFactory