Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/callumacrae/phpcheck

A testing library for PHP loosely based on Haskell's QuickCheck library.
https://github.com/callumacrae/phpcheck

Last synced: 2 months ago
JSON representation

A testing library for PHP loosely based on Haskell's QuickCheck library.

Awesome Lists containing this project

README

        

# PHPCheck

PHPCheck is a testing library for PHP loosely based on Haskell's QuickCheck.

## Installation

There are two ways of getting PHPCheck into your project. The first is to require it as you would any other PHP library:

```php
claim` method to make "claims". It accepts the following arguments:

```php
$phpcheck->claim( string $testName , function $predicate [ , array $specifiers ] )
```

`$testName` is the name of the test (obviously).

`$predicate` is a function which returns true if the test passes. Anything else is a fail.

`$specifiers` is an optional array of specifiers to be passed to the predicate function. They are usually like this:

```php
group('Numbers');

$tests->claim('Less than', function ($a, $b) {
return ($a < $b);
}, array(
PHPCheck::Number(0, 10),
PHPCheck::Number(10, 20);
));

$tests->check();
```

## License

![Creative Commons License](http://i.creativecommons.org/l/by-sa/3.0/88x31.png)

This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/).