PHPackages                             klei/phut - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. klei/phut

ActiveLibrary[Testing &amp; Quality](/categories/testing)

klei/phut
=========

A small and simple unit testing framework for PHP 5.3+

v0.1.0(14y ago)3421MITPHPPHP &gt;=5.3.0

Since Jun 19Pushed 13y ago2 watchersCompare

[ Source](https://github.com/klei-dev/phut)[ Packagist](https://packagist.org/packages/klei/phut)[ Docs](http://klei.se/phut)[ RSS](/packages/klei-phut/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Phut
====

[](#phut)

**Phut** is a small unit test framework for PHP 5.3+, inspired by [NUnit](http://nunit.org)

Build status
------------

[](#build-status)

- [master](https://github.com/klei-dev/phut) [![Master Build Status](https://camo.githubusercontent.com/fe126e3de659f16d58e41b8f64e6cc1e53a776062b58f7eb3883368adc7d3eea/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6b6c65692d6465762f706875742e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/klei-dev/phut)
- [develop](https://github.com/klei-dev/phut/tree/develop) [![Develop Build Status](https://camo.githubusercontent.com/3e019c6111fb5bb9555d514ca6c275b981b807f850e0396ea9a6b42746055910/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6b6c65692d6465762f706875742e706e673f6272616e63683d646576656c6f70)](http://travis-ci.org/klei-dev/phut)

What is Phut
------------

[](#what-is-phut)

Phunit is a **PH**P **U**nit **T**est framework which uses annotations to mimic the behavior of NUnit for .Net.

Why another unit testing framework?
-----------------------------------

[](#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
------------

[](#installation)

You can install **Phut** using one of the following methods.

### Using Composer

[](#using-composer)

One simple way to install Phut is to use [Composer](http://getcomposer.org/). First create or modify your `composer.json` file in the project root to include:

```
{
    "require": {
        "klei/phut": "*"
    },
    "config": {
        "bin-dir": "bin/"
    }
}
```

Then download `composer.phar` from  and run:

```
php composer.phar install

```

### Or using git

[](#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
-----------------------

[](#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 `@TestFixture` and each test with `@Test`.

A simple test could therefore look like this:

```
