Zend_Test

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.

Michelangelo van Dam’s Blog: Unit testing with Zend Framework 1.8+

Michelangelo van Dam gave recently a presentation about testing Zend Framework applications. His presentation triggered discussion and lots of questions about setting up testing environment for Zend Framework. Because of that he decided to post tutorial about creating the environment, writing simple test, running it and generating some metrics.

We start off by setting our environment best fitted for our unit testing. I use a virtual linux system for this, using VMWare, but with some extra background research these global settings can be applied for your own (test) environment as well.

This is well written introductory tutorial about testing action controllers. It lets you start testing action controllers in 5 minutes.

PHPUnit 3.4.0 released

A year (and a bit) after releasing PHPUNit 3.3.0 Sebastian Bergmann has released first stable version of new PHPUnit 3.4 line. Among lots of improvements and fixes, about which you can read in changlog, new version introduces support for test dependencies, fixture reuse and running tests in separated processes. Sebastian reveals also what new features PHPUnit 3.5 will have:

Work on PHPUnit 3.5 has already started: the php-code-coverage project on GitHub is home to a refactoring of PHPUnit’s code coverage functionality that will be one of the “hallmark features” of PHPUnit 3.5. It will also make PHPUnit’s code coverage functionality available outside the scope of PHPUnit.

PHPUnit is being used by Zend Framework team to write and run tests of the framework itself. It is also base library for Zend_Test component (Zend_Test_PHPUnit to be exact).

by Wojciech Szela on September 21, 2009 in News, No Comments »
tags: , ,