News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend Developer Zone:
Zend Framework application's PHPUnit suite 3x faster
October 29, 2010 @ 09:49:54

On the Zend Developer Zone today there's a new tutorial by Olek Janiszewski with a suggestion to help make the execution of your application's PHPUnit tests around three times faster. There's two problems that he sees as the slowdowns - truncating tables after the test runs and declaring tables in controller tests.

As I've mentioned before, Zend Framework isn't really encouraging developers to do TDD (on the other hand, this shouldn't be a surprise in the PHP community). The application architecture is based on singletons all around (front controller, session, layout, helper broker, registry, etc.), the bootstrap doesn't "separate the cacheable from the non-cacheable", there's no built-in support for dependency injection, the ORM is cumbersome to stub out.

So, as a solution to these problems, he suggests a simpler way to handle the test by wrapping the entire thing in a transaction and then rolling it back after the case is done. There are a few issues with doing it this way, though. There's four of them - that the database connection isn't really shared, MyISAM tables, issues with expected primary key values and a performance boost but only on certain systems.

In the comments, there's a note about two things that could help this situation and are already included in some of the Zend Framework functionality - Zend_Test_PHPUnit_DatabaseTestCase and ControllerTestCase.

0 comments voice your opinion now!
phpunit unittest zendframework performance database controller


blog comments powered by Disqus

Similar Posts

Daniel Krook's Blog: CakePHP DB2 driver alpha released

SitePoint PHP Blog: Free PHP Webinar: How to Increase Performance with Caching

NetTuts.com: Test Code Coverage: From Myth to Reality

Ralph Schindler's Blog: Composite Rowsets For Many-To-Many Relationships Via Zend_Db_Table

Tobias Schlitt's Blog: PHP@FrOSCon - Timetable online!


Community Events





Don't see your event here?
Let us know!


series interview introduction developer framework list install refactor symfony2 laravel language release threedevsandamaybe opinion code community experience podcast unittest testing

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework