Clone this wiki locally
Snap Unit Testing
SnapTest is a powerful unit testing framework for PHP 5+, leveraging PHP’s unique runtime language to simplify the unit test process without sacrificing the agility tests provide.
SnapTest is a free software project licensed under the new BSD License.
- JUnit Compliant Test Harness
- TAP Compliant Test Output
- Runnable from Command Line via .sh or .php scripts
- Full support for mock objects at runtime (minimum parallel structures) as actors and critics
- Extensible addon system for adapting SnapTest to just about any developer environment
- PHP 5.0.0+ (tested 5.1.5+ Debian, 5.2.3+ OSX)
- PHP binary in user path, /usr/local/bin, /opt/usr/local/bin, or in known location
- Basic familiarity with unit testing concepts
The latest released version is available at
Bleeding edge versions can be obtained via git:
A browseable version of the history is available at
Note: The Git Repository will always be more bleeding edge than releases. This is because the project runs primarily on the git version control system. As more distributed branches are available, they will be listed above.
“Mission Statement” of Sorts
To put it simply, unit testing should be transparent. There shouldn’t be the complexity of test harnesses and coding out stub files. This functionality should be there if you want it, but the barrier to writing tests should be so low that it becomes easier to write the test than the code itself. It is on this philosophy that SnapTest was built.
These are some of the goals of SnapTest and the SnapTest project (or at least a concept of what we are trying to do here) in no particular order:
- Build a PHP unit testing framework
- Create a 0-effort harness. Easy to run the code, easy to get results
- Maintain transparency in the code and the community
- Be as non-intrusive as possible
- Be memory efficient
- Link to complex infrastructures easily
- Take advantage of the OO structure PHP 5 provides
- Emphasize end-users as one of the most important resources
- Promote unit testing in a non-oo PHP world
Code quickly; it’s a snap.