On the Xebee blog there’s a recent post looking at test-driven development with the Zend Framework and PHPUnit.
Over the past few days I was going through the Zend Framework reference docs and I found myself pleasantly surprised with all that the latest version of this web application framework provides. My first thought was to just acknowledge the speed in which PHP as a technology has been maturing. Out of the many new features, what stood out for me was the ease with which Zend Framework and PHPUnit complement and work with each other.
They show how they use PHPUnit, Zend_Test and Selenium to create database and acceptance/functional tests.
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.
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.
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).