I am quite new to the world of testing and I want to make sure I am on the right track.
I am trying to setup unit tests in a symfony2 project using phpunit.
PHPUnit is working and the simple default controller tests work fine. (Yet this is not about functional testing but unit testing my application.)
My project relies heavily on database interactions though, and as far as I understand from phpunit's documentation, I should set up a class based on \PHPUnit_Extensions_Database_TestCase
, then create fixtures for my db and work from there.
Yet, symfony2 only offers a WebTestCase
class which only extends from \PHPUnit_Framework_TestCase
out of the box.
So am I right to assume that I should create my own DataBaseTestCase
which mostly copies WebTestCase
, only difference being that it extends from \PHPUnit_Extensions_Database_TestCase
and implements all its abstract methods?
Or is there another "built-in" recommended workflow for symfony2 concerning database-centric tests?
As I want to make sure that my models store and retrieve the right data, I do not want to end up testing the specifics of doctrine by accident.