Answer the question
In order to leave comments, you need to log in
How to test (xUnit) application with DB access?
Help with understanding how to test (in my case PHPUnit) an application in which 95% of class methods use database access? I work with the Silex framework in conjunction with Doctrine.
I studied materials on substitution of mock objects, about using a third-party database for testing, and other materials. But there is no complete understanding of what all the same needs to be done in such cases, because in the methods and select'y and insert'y (and the methods are not multitasking).
Answer the question
In order to leave comments, you need to log in
Well, why not give the test application access to the database? Mock will not allow you to test the interaction with the base.
A possible solution to your question would be the following:
1. Doctrine Fixtures
2. A separate database and configuration file for the test environment
3. During the test run, start a transaction at the time of completion, roll it back.
...
Profit :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question