Download the PHP package klei/phut without Composer
On this page you can find all versions of the php package klei/phut. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package phut
Short Description A small and simple unit testing framework for PHP 5.3+
License MIT
Homepage http://klei.se/phut
Informations about the package phut
Phut
Phut is a small unit test framework for PHP 5.3+, inspired by NUnit
Build status
What is Phut
Phunit is a PHP Unit Test framework which uses annotations to mimic the behavior of NUnit for .Net.
Why another unit testing framework?
I was tired searching for a unit testing framework for PHP that:
- Fully supports namespaces
- Is easy to setup
- Works on Windows without a hassle
So finally, when I didn't find a single framework that did all of the above, I decided to do it myself.
Installation
You can install Phut using one of the following methods.
Using Composer
One simple way to install Phut is to use Composer. First create or modify your file in the project root to include:
Then download from http://getcomposer.org/ and run:
php composer.phar install
Or using git
You could also clone the Phut repository with:
git clone git://github.com/klei-dev/phut.git
Then download composer.phar as above and execute the following:
php composer.phar install
Writing your first test
As mentioned above Phut uses annotations to work. The name of the annotations is directly inspired by the NUnit framework for .Net. I.e. a test class must be annotated with and each test with .
A simple test could therefore look like this:
You can then run your test with the command:
bin/phut [<test-folder-name>|<test-file-name>]
If no folder () or file () is specified, the runner defaults to the folder .
The future for Phut
Stuff for future releases:
- More extensive Assert-class
- annotation to write parameterized tests
- Optional parameter for the annotation to be able to categorize tests and run only certain categories
Copyright
Copyright © 2012, Joakim Bengtson. See LICENSE.
Questions?
You can find me here at GitHub and via twitter at @joakimbeng.

