Unit Testing a Symfony Service


In this video we look at how we can use Codeception's Unit test suite functionality to do TDD against a Symfony 2 service.

We'll start off by generating ourselves a new Codeception Unit test which we can then use as the basis for actually writing our tests.

Whilst this is a gentle introduction to unit testing, it does cover something that you will quickly encounter in the real world - repeating tests that change only the data, not the test. There's a very elegant solution to this - using PHPUnit's @dataProvider syntax - so even if you're quite comfortable with unit testing, please do check out the video from around the 08:30 mark, where we begin looking at the data provider, and how it can streamline your test suite nicely.

Code For This Course

Get the code for this course.

Code For This Video

Get the code for this video.

Episodes