Chapter 8. Testing symfony and symfony Projects

Fabien Potencier

WHAT'S IN THIS CHAPTER?

  • symfony release management

  • Evolution of the symfony test suite

  • Drawbacks of the singleton design pattern

  • Advantages of dependency injection

  • Using a dispatcher to reduce dependencies between objects

  • Pragmatic approach to testing

  • Unit testing and the lime testing library

  • Functional tests for end-to-end application testing

  • Debugging functional tests

Testing should be one of the main concerns of Web developers, but the truth is it's not yet as widespread as it ought to be. It is still the most neglected part of a Web development process. Most developers still think they cannot afford writing tests because the client budget is too tight or because the deadline is too short. But it's quite the opposite. A comprehensive test suite can save your day when you are under such a time constraint and/or a budget constraint. Because it is rather counterintuitive, we, as a community, need to educate developers and provide tools that ease testing.

Since the beginning of the project five years ago, the symfony framework project (http://www.symfony-project.org/) has tried to advocate Web development best practices, and as such, one of its main goals is to lower the barrier of entry to testing by providing pragmatic, simple, and easy-to-learn tools that speed up the creation of tests.

This case study is divided into two parts. In the first one, we see how the symfony framework itself is tested, what the specific challenges ...

Get Real-World Solutions for Developing High-Quality PHP Frameworks and Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.