PHPackages                             artox-lab/pho - 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. [Framework](/categories/framework)
4. /
5. artox-lab/pho

ActiveLibrary[Framework](/categories/framework)

artox-lab/pho
=============

A BDD testing framework

1.1.1(11y ago)03.3kMITPHPPHP &gt;=5.4.0

Since Nov 28Pushed 11y ago3 watchersCompare

[ Source](https://github.com/artox-lab/pho)[ Packagist](https://packagist.org/packages/artox-lab/pho)[ Docs](https://github.com/danielstjules/pho)[ RSS](/packages/artox-lab-pho/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

[![pho](https://camo.githubusercontent.com/660a8edbfd23cbe51b053ae5b3e3ba48c0f5434eb0a05c4b453e03cc5db813b0/687474703a2f2f64616e69656c73746a756c65732e636f6d2f6769746875622f70686f2d6c6f676f2e706e67)](https://camo.githubusercontent.com/660a8edbfd23cbe51b053ae5b3e3ba48c0f5434eb0a05c4b453e03cc5db813b0/687474703a2f2f64616e69656c73746a756c65732e636f6d2f6769746875622f70686f2d6c6f676f2e706e67)

BDD test framework for PHP, inspired by Jasmine and RSpec. Features a familiar syntax, and a watch command to automatically re-run specs during development. It can also be extended with custom matchers and reporters.

[![Build Status](https://camo.githubusercontent.com/cd5a859a5f164b566cf51f573b1d42303da20cef1368b973a8bffd7175fa2e0f/68747470733a2f2f7472617669732d63692e6f72672f64616e69656c73746a756c65732f70686f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/danielstjules/pho)

- [Installation](#installation)
- [Usage](#usage)
- [Writing Specs](#writing-specs)
- [Running Specs](#running-specs)
- [Expectations/Matchers](#expectationsmatchers)
- [Custom Matchers](#custom-matchers)
- [Reporters](#reporters)
- [Mocking](#mocking)
- [Namespace](#namespace)

Installation
------------

[](#installation)

The following instructions outline installation using Composer. If you don't have Composer, you can download it from

- Run either of the following commands, depending on your environment:

```
$ composer global require danielstjules/pho:dev-master
$ php composer.phar global require danielstjules/pho:dev-master

```

- Edit your `~/.bash_profile` or `~/.profile` and add:

```
export PATH=$HOME/.composer/vendor/bin:$PATH

```

Usage
-----

[](#usage)

```
Usage: pho [options] [files]

Options

   -a   --ascii                     Show ASCII art on completion
   -b   --bootstrap      Bootstrap file to load
   -f   --filter           Run specs containing a pattern
   -h   --help                      Output usage information
   -n   --namespace                 Only use namespaced functions
   -r   --reporter            Specify the reporter to use
   -s   --stop                      Stop on failure
   -v   --version                   Display version number
   -w   --watch                     Watch files for changes and rerun specs
   -C   --no-color                  Disable terminal colors
```

Writing Specs
-------------

[](#writing-specs)

Pho exposes a DSL for organizing and writing your tests, which includes the following functions: `describe`, `context`, `it`, `before`, `after`, `beforeEach`, `afterEach` and `expect`. Equivalent functions for disabling specs and suites also exist via `xdescribe`, `xcontext` and `xit`.

To create a suite, `describe` and `context` can be used by passing them a string and function. Both are interchangeable, though context is more often nested in a describe to group some set of behaviour. `it` is then used to create a spec, or test.

A spec may contain multiple expectations or assertions, and will pass so long as all assertions pass and no exception is uncaught. For asserting values in pho, `expect` can be used. The function accepts the value to be tested, and may be chained with a handful of matchers.

```
