Prediction package for CLI output
$ composer require try/predict-output<?php
require_once '/path/to/autoload.php';
use TryPhp\PredictOutputTrait;
$assertions = new class() {
use PredictOutputTrait();
}
$assertions->predictOutput(function () {
echo '\e[33msomething\n';
}, 'something'); // won't throw an exception
$assertions->predictOutput(function () {
echo '\e[33msomething\n';
}, 'something other'); // will throw an exceptionMethod to compare an output capture with a given string.
| 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. |
GPL-2.0 © Willi Eßer