Giorgio Sironi’s Blog: How not to test controllers
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.

