wikidi / 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.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 5 270
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 12
Forks: 1
Open Issues: 1
Type:tool
Requires
- php: >=5.3.0
Requires (Dev)
- apigen/apigen: 2.8.*
README
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
- copy Envtesting.php and folder envtests
- create index.php and require Envtesting.php
- add some test to Suite
- return output as html/csv/txt
Envtesting advantages
Envtesting provide multiple way how to test something. You can test:
- using regular PHP file
- using anonymous function
- using static or regular callback
- using object with __invoke function
<?php require_once __DIR__ . '/Envtesting.php'; $suite = new \envtesting\Suite('my great envtest'); $suite->addTest('APC', 'envtests/library/Apc.php', 'apc'); // by file echo $suite;
or using singelton instance of Suite
<?php require_once __DIR__ . '/Envtesting.php'; Suite::instance()->addTest('APC', 'envtests/library/Apc.php', 'apc'); // by file echo Suite::instance();
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');
Using 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
Visit more examples in: https://github.com/wikidi/envtesting/tree/master/example
Requirments
- PHP 5.3 +
Update
npm intall # install all NPM deps
composer install # install Apigen
# reelase
grunt release # update api docs, minify and release minor version
# or one by one
grunt minify # minify (shrink) PHP file
grunt doc # generate Apigen docs
grunt bump # release minor version
# or release major version
grunt bump:major # release major version
- PHP 5.3 +
Media
Meta
Author: wikidi.cz & Roman Ožana
For the license terms see LICENSE.TXT files.