I'm new to unit testing and I'm trying to get started with PHPUnit on an existing project I'm working on.
The problem I'm facing is that I have lots of unit tests that require a database which is fair enough. I've set up an SQLite DB for the sole purpose of unit testing. Sometimes I want to drop and re-create the database for new tests (by this I mean each separate classes), to prevent unnecessary data clashes.
However, sometimes I don't want this to happen if I have unit tests in the same class that depend upon one another; these may need access to data that was saved in a previous test.
I am currently getting a "fresh" database in the setUp() function of each class. What I didn't anticipate is that this function (as with __construct()) would run after every test case within said class.
Is there a way that I can flush the database with each test class? Or am I going about the entire process incorrectly?
Any tips appreciated, thanks.