Unit Testing Zend Framework Applications
CodeUtopia has some thoughts on Unit Testing Zend Framework applications.
There are some good points made, particularly on the difficulty of realistically testing Controller classes:
Controller testing can be the most difficult part, and this is where you may need to perform some refactoring if your design is not suitable for testing. For example, you may have a lot of logic in your controllers, which might be better off in your models or library code. Testing the whole idea of getting out the correct output or redirects may be difficult.
Zend probably should have had a Unit Testing strategy when developing the Framework initially, but, as always, the community fills in the holes. This also highlights another problem developing PHP applications: there is no standard build process, in which scripts can be unit tested, compiled, optimized, packaged, etc. There are solutions available (Phing is popular, it’s even possible to use Ant) but this is an area where Zend could show real leadership and come up with their own industry-standard, solution (maybe even as part of the Zend Framework, or Zend Studio). I’m not holding my breath, but you never know.
Related Articles
Tags: ant, build, code, Development, phing, PHP, Programming, Zend Framework