PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Wojciech Sznapka's Blog: Fully isolated tests in Symfony2

Note: This article was originally published at PHPDeveloper on 16 June 2011.
PHPDeveloper

Wojciech Sznapka has a new post to his blog today looking at his creation of fully isolated tests as a part of a Symfony2 application. He talks about two issues he recently solved with testing services in this popular framework.

The most important thing you should provide with your re-usable bundles is unit tests set. Lately I solved two major cases which Symfony2 hasn't got out of the box: testing services, defined in Dependency Injection Container and running model tests with fixtures in fully isolated environment.

He includes code snippets for both solutions - a BaseTestClass for working with dependency injection testing and a ModelTestCase class that, in the setUp(), loads in the required fixtures so the test can be completely isolated.