md/eris-runner

There is no license information available for the latest version (0.1.0) of this package.

0.1.0 2017-08-28 09:31 UTC

This package is not auto-updated.

Last update: 2024-12-08 04:02:28 UTC


README

Eris Runner is a test runner for Eris

With this runner you don't need an extra testing framework to run your Property Based Testing.

All you need is a directory or a file with properties written like this:

<?php

property ("strings have the same length in reverse", function() {
    forAll (Gen::string()) (function ($s) {
        Assert::same(strlen($s), strlen(strrev($s)));
    });
});

property ("positive integers squared are always bigger than themselves", function() {
    forAll (Gen::integer())
        // ok zero * zero is still zero
        ->when (function($x) { return $x > 0; })
        ->then (function ($x) {

        // Should fail! Did you think about 1? ;-)
        Assert::greaterThan($x * $x, $x);
    });
});

Then just call the runner to run all tests in the tests folder:

$ bin/eris tests

Or a single php file:

$ bin/eris my_test.php

Note that Eris Runner lets you use Webmozart's Assert library as assertions. But you can use whatever you like. Just make sure you throw some exception.