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

https://github.com/paranoiq/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.
https://github.com/paranoiq/envtesting

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# 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:

- using regular PHP file
- using [anonymous function](http://php.net/manual/en/functions.anonymous.php)
- using static or regular "callback"(http://php.net/manual/en/language.types.callable.php)
- using object with [__invoke function](http://www.php.net/manual/en/language.oop5.magic.php#object.invoke)

```php
addTest('APC', 'envtests/library/Apc.php', 'apc'); // by file
```

Using anonymous function:

```php
addTest('SOMETHING', function() {
if (true === false) throw new \envtesting\Error('True === false');
}, 'boolean');
```

Usin regular callback:

```php
addTest('callback', array($test, 'perform_test'), 'callback');
```
Using static callback string:

```php
addTest('callback', '\we\can\call\Something::static', 'call');
```

Test using object with __invoke:

```php
addTest('memcache', new \envtests\services\memcache\Connection('127.0.0.1', 11211), 'service');
```

Tests can be grouped into group:

```php
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
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
render('csv'); // render CSV output
$suite->render('html'); // render HTML output
```

![HTML output example](/wikidi/envtesting/raw/master/doc/images/html-output-example.png "HTML output")

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

## Requirments

- PHP 5.3 +

## API docs

Don't forget update docs !!!

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

## Meta

Author: [wikidi.com](http://wikidi.com) & [Roman Ožana](https://github.com/OzzyCzech)

For the license terms see LICENSE.TXT files.