PHPUnit 3 has been released
Sebastian Bergmann and his contributors are proud to announce the immediate availability of PHPUnit 3. This release is a major improvement to the popular open source testing solution for PHP applications. It includes new features and bug fixes. Further details about this release can be found in the ChangeLog.
New Features
PHPUnit 3 introduces a number of new features that make it easier to use and more versatile than previous versions.
Mock Objects
How can you test that a method works correctly when it is called from another method? How can you isolate your tests from external influences? Mock Objects and Stubs provide the answer to these and other questions.Selenium Integration
PHPUnit 3 integrates with Selenium RC to support both acceptance testing (by performing higher-level tests on the integrated system instead of just testing each unit of the system independently) and browser compatibility testing (by testing the web application on different operating systems and browsers).Code-Coverage
How do you test your tests? How do you find code that is not yet tested— or, in other words, not yet covered by a test? How do you measure testing completeness? All these questions are answered by a practice called Code-Coverage Analysis . PHPUnit 3 features an improved report generator that provides detailed code-coverage information for tests run.Installation PHPUnit should be installed using the PEAR Installer.
The PEAR channel (pear.phpunit.de) that is used to distribute PHPUnit needs to be registered with the local PEAR environment:
pear channel-discover pear.phpunit.deThis has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel:
pear install phpunit/PHPUnitPrevious installations of the PHPUnit and PHPUnit2 packages from the pear.php.net channel have to be uninstalled since PHPUnit is no longer hosted on PEAR.
Upgrading from PHPUnit 2.3 PHPUnit 3 is backwards compatible with PHPUnit 2.3.
Please note that in PHPUnit versions 2.0-2.3 the class names were prefixed with PHPUnit2_ instead of PHPUnit_. Existing test cases will still work with PHPUnit version 3.0, but it is highly recommended to update them to use the new class names.
About PHPUnit
In the last decade, PHP has developed from a niche language for adding dynamic functionality to small websites to a powerful tool making strong inroads into large-scale Web systems. Critical business logic like this needs to work correctly. But how do you ensure that it does?
You test it, of course.
To make code testing viable, good tool support is needed. This is where PHPUnit comes into play. It is a member of the xUnit family of testing frameworks and provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyse their results.
About Sebastian Bergmann
Sebastian Bergmann is a long-time contributor to various PHP projects, including PHP itself. He is currently working at eZ systems AS in Skien, Norway on the Workflow Management component for the eZ platform. As the developer of PHPUnit, he also helps with testing the eZ components. In his free time he likes to hack on Open Source software and to take photographs, preferably while traveling the world.

Comments