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

https://github.com/try-php/predict-output

Prediction package for CLI output
https://github.com/try-php/predict-output

php7 test testing tryphp

Last synced: over 1 year ago
JSON representation

Prediction package for CLI output

Awesome Lists containing this project

README

          

# predict-output

> Prediction package for CLI output

[![Build Status](https://travis-ci.org/try-php/predict-output.svg?branch=master)](https://travis-ci.org/try-php/predict-output)

## Install

```bash
$ composer require try/predict-output
```

## Usage

```php
predictOutput(function () {
echo '\e[33msomething\n';
}, 'something'); // won't throw an exception

$assertions->predictOutput(function () {
echo '\e[33msomething\n';
}, 'something other'); // will throw an exception
```

## API

### Methods

#### `predictOutput($capture, $content)`

Method to compare an output capture with a given string.

##### Arguments

| Arguments | Type | Description |
|---|---|---|
| $capture | `callable` | Closure from which every output buffer write will be captured. |
| $content | `string` | Content to which the output will be compared to. |

## License

GPL-2.0 © Willi Eßer