Zend Framework 1.9 released

Last Friday Zend Framework team released new version of the framework, 1.9. It brings few new features and round 700 bugfixes. Since you can read official release note on devzone.zend.com, I will only comment things that are most interesting for me.

Most usefull and awaited by me is new component Zend_Test_PHPUnit_DB. I am big testing and quality assurance in general evangelist, so having another tool to simplify working with tests is what I like most. Since today I can drop my own classes adding database testing support to Zend_Test_PHPUnit_ControllerTestCase. No more hackery. With new database testing component you can setup database connection and state before each test in simple and clean manner. Actually in some cases you don’t have to even connect to database . You can instantiate DB Adapter that requires no database (Zend_Test_DbAdapter) and acts as SQL and result stack. Pretty handy.

Working with test data sets is much simplified comparing to original database test case form PHPUnit. You can use xml fixture files as initial data set as well, as expected results data set. The only thing I am missing is using multiple files to define initial data. I am used to having one fixture file per one table plus some special cases fixtures, like data for specific bug. It gives me greater control over data I use in tests, flexibility I need for complex applications. But it would not be Zend Framewok if you couldn’t do anything about it. Using PHPUnit I had to 3 new classes to do that and it was not so straight forward solution. Here I have simple to extend API. Looks like I’ll spend next few days on migrating tests I have in project I just begun.

Many people, including me, are very happy to see new component in Zend Framework, Zend_Queue. It’s name should stand for itself. It is common API for interacting with queues. Whether you are using some industry standard queues, like ActiveMQ or MemcacheQ, or you were always implementing your own (most people use database to queue some operations and data), Zend_Queue will be huge improvement in your work. If you don’t know how you could use it, image a situation where you have more task to perform than available resources at the moment. You can queue tasks and perform them one by one. Zend_Queue gives you such opportunity, and it can use different backend to store actual tasks (or rather messages).

Last but not least is support for plurals in Zend_Translate. I could not believe that initial version of Zend_Translate does not support plurals. It’s annoying enough that very popular internationalization and localization library, gettext, does not support gender inflection. In previous Zend Framework releases it did not support plurals too. Now it does. For me it means less trickery with translations.

There are much more changes in Zend Framework 1.9. Some of them might be more useful for some people, but these three give me immediate benefits. In each project I was involved in past few years we had some queues, tests using database and data sets and queues. And each time we were re-inventing the wheel. Thanks to new Zend Framework these features are simpler to implement now, flexible and we have common API.

Zend_Test_DbAdapter

Author: Wojciech Szela

CSM, Consultant, Manager, Entrepreneur and Open Source Contributor. Scrum and eXtreme Programming practitioner. Evangelist of healthy work environment, high quality products, people development and team work.