try/tapping

Atomic testing

0.1.1 2018-02-05 10:52 UTC

This package is not auto-updated.

Last update: 2024-12-27 22:25:28 UTC


README

Atomic testing

demo

Build Status Technical dept

Install

$ composer require try/tapping

Usage

<?php
require_once '/path/to/autoload.php';

use function Tapping\test;

test('some description of the test', function ($t) {
	// throw an Exception or exit(1) to fail a test
});

API

Functions

test($description, $test)

Function to run an atomic test and output it's status.

Arguments
CLI Flags

Since the runner of the tests is pure php, it is necessary for the usage in CI pipelines or other build systems that the main test process exists with an error code. Tapping has a build in feature for this.

By providing script flags on script call, e.g.

$ php test.php --build

The test run will exit the whole process with -1, as soon as the first test fails.

Flag aliases which trigger such behaviour are --build and -b.

In addition to the build flag, it is also possible to provide an --quite (short -q) flag to suppress fail information (File, Line and error that occured).

todo($description)

Function to show a notation for a test case, not yet written. As reminder or note or whatever.

Arguments

$t

The $t argument, is a container for prediction and likewise functions.

Predictions

License

GPL-2.0 © Willi Eßer, Felix Buchheim