LiveDocX service is getting popular. It lets you prepare PDF, DOCX, DOC and RTF documents using templates. On PHPFreaks.com you can read about how to use LiveDocX component of Zend Framework.
The key point with LiveDocx is to reduce the effort required to generate well-formatted, print-ready word processing documents to an absolute minimum. For the end-user, the logic involved in creating any of the supported file formats is identical. For example, regardless of whether you want a PDF or RTF file, the code, with the exception of one parameter, is the same.
Sounds interesting? It should. This new approach reduces time developers spent on writing document generation code.
There has been lots post published about unit testing in Zend Framework recently. Most of them show how to setup simple testing environment and write simple test. In his recent post Giorgi Sironi shows how not to test Zend Framework action controllers.
Yesterday on twitter a discussion started about how to properly design Zend Framework action controllers to allow simplicity of testing, specifically how to inject collaborators in controllers and to avoid breaking the law of Demeter.
Presented real life example seems to be simple and typical. Giorgio explains what is wrong about it and what kind of obstacles from unit testing point of view it creates. The post is not only about how no to test controllers but also about what controllers should and should not do.
Update
Giorgio’s post has its continuation, where he explains why we can drop unit testing controllers and what controllers really do.
Update 2
Giorgio published another follow up to his, as we see controversial, post.
Unit testing is very simple concept, at least in theory. Once you try to implement it, obstacles arise, often specific to your product and environment. This is where AvnetLabs’ series on unit testing in Zend Framework comes useful:
In the coming weeks, I’ll put together a how-to on testing ZF applications using a Test Driven Development (TDD) approach. With TDD tests are written first and as such the test suite guides the design of the production code.
First article in the series shows how to setup simple application and write simple test. Good starter for beginner.