PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Zend Framework application's PHPUnit suite 3x faster

Note: This article was originally published at Zend Developer Zone on 28 October 2010.
Zend Developer Zone
My regular readers may have already noticed I don't even dare writing code without TDD/BDD-ing it from left to right. In my Zend Framework-based project, we currently have 600+ PHPUnit test cases, most of them for models and controllers, but quite some also for view helpers, bootstrap and even some views. The whole suite is taking around 90 seconds to run on my machine against a MySQL database (modelled with Zend_Db* in an active record/table data gateway manner).In this post I'll be showing how I managed to decrease the time from ~90 seconds to ~30 seconds using a PHPUnit listener and database transactions. NOTE: This is a copy of the original article on using PHPUnit listeners to wrap each test case in a database transaction available under this link .