Is there a standard way of cleaning your database before (or after) each test when you're testing with Symfony2/PHPUnit? There seems to be a standard, obvious way to do this in Rails but I haven't found an analog in the Symfony community.
You can either purge the tables with Doctrine's data purger or rebuild the schema before every test.
Purger is part of data-fixtures package: https://github.com/doctrine/data-fixtures
I once wrote a KernelAwareTest which rebuilds the schema before every test: https://gist.github.com/1319290
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With