Answer the question
In order to leave comments, you need to log in
How to make a uint-test adding to the database?
PHP language. I want to test whether the registration on the site is broken.
There is a plan to generate an e-mail like microtime(true)@domain.ru in the test and write it to the database using a method from the User class (this is the key point that the test does not write itself, in fact we are testing this method), but the test should immediately request the result from the database and check if it is there.
Is this already integration testing and not Unit?
How to do it correctly, in particular, is it possible and how to pass a connection to the database to the test class?
And is it all correct? I don’t know how else, I don’t understand mocks and stubs yet ((
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question