Skip to content

Fast simple and easy to use environment testing written in PHP. Can check library, services and services response. Produce console, HTML or CSV output.

License

Notifications You must be signed in to change notification settings

paranoiq/envtesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

envtesting

Fast simple and easy to use environment testing written in PHP. Can check library, services and services response. Produce console, HTML or CSV output.

How to use

Envtesting provide multiple way how to test something. You can test:

<?php
$suite = new \envtesting\Suite('my great envtest');
$suite->addTest('APC', 'envtests/library/Apc.php', 'apc'); // by file

Using 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 group

Envtesting 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 output

HTML output example

Visit more examples in: https://github.com/wikidi/envtesting/tree/master/example

Requirments

  • PHP 5.3 +

API docs

Don't forget update docs !!!

php ~/workspace/apigen/apigen.php --source ./envtesting --source ./envtests --destination ./doc/api --todo --title "Envtesting"

Meta

Author: wikidi.com & Roman Ožana

For the license terms see LICENSE.TXT files.

About

Fast simple and easy to use environment testing written in PHP. Can check library, services and services response. Produce console, HTML or CSV output.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published