Fast simple and easy to use environment testing written in PHP. Can check library, services and services response. Produce console, HTML or CSV output.
Envtesting provide multiple way how to test something. You can test:
- using regular PHP file
- using anonymous function
- using static or regular "callback"(http://php.net/manual/en/language.types.callable.php)
- using object with __invoke function
<?php
$suite = new \envtesting\Suite('my great envtest');
$suite->addTest('APC', 'envtests/library/Apc.php', 'apc'); // by fileUsing anonymous function:
<?php
require_once __DIR__ . '/Envtesting.php';
$suite = new \envtesting\Suite('my great envtest');
$suite->addTest('SOMETHING', function() {
if (true === false) throw new \envtesting\Error('True === false');
}, 'boolean');Usin regular callback:
<?php
require_once __DIR__ . '/Envtesting.php';
$suite = new \envtesting\Suite('my great envtest');
$suite->addTest('callback', array($test, 'perform_test'), 'callback');Using static callback string:
<?php
require_once __DIR__ . '/Envtesting.php';
$suite = new \envtesting\Suite('my great envtest');
$suite->addTest('callback', '\we\can\call\Something::static', 'call');Test using object with __invoke:
<?php
require_once __DIR__ . '/Envtesting.php';
$suite = new \envtesting\Suite('my great envtest');
$suite->addTest('memcache', new \envtests\services\memcache\Connection('127.0.0.1', 11211), 'service');Tests can be grouped into group:
<?php
require_once __DIR__ . '/Envtesting.php';
$suite = new \envtesting\Suite('my great envtest');
$suite->group->addTest('memcache', new \envtests\services\memcache\Connection('127.0.0.1', 11211), 'service');
$suite->group2->addTest('memcache', new \envtests\services\memcache\Connection('127.0.0.1', 11211), 'service');You can shuffle groups of shuffle tests inside groups:
<?php
require_once __DIR__ . '/Envtesting.php';
$suite = new \envtesting\Suite('my great envtest');
$suite->group->addTest('memcache', new \envtests\services\memcache\Connection('127.0.0.1', 11211), 'service');
$suite->group->addTest('memcache', new \envtests\services\memcache\Connection('127.0.0.1', 11211), 'service');
$suite->group2->addTest('memcache', new \envtests\services\memcache\Connection('127.0.0.1', 11211), 'service');
$suite->shuffle(); // mix only groups
$suite->shuffle(true); // deep shuffle mix groups and tests inside groupEnvtesting can render CSV, HTML or text output:
<?php
require_once __DIR__ . '/Envtesting.php';
$suite = new \envtesting\Suite('my great envtest');
echo $suite; // generate TXT output
$suite->render('csv'); // render CSV output
$suite->render('html'); // render HTML outputVisit more examples in: https://github.com/wikidi/envtesting/tree/master/example
- PHP 5.3 +
Don't forget update docs !!!
php ~/workspace/apigen/apigen.php --source ./envtesting --source ./envtests --destination ./doc/api --todo --title "Envtesting"Author: wikidi.com & Roman Ožana
For the license terms see LICENSE.TXT files.
