尝试/触摸

原子测试

0.1.1 2018-02-05 10:52 UTC

This package is not auto-updated.

Last update: 2024-09-20 21:12:06 UTC


README

原子测试

demo

Build Status Technical dept

安装

$ composer require try/tapping

用法

<?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

函数

test($description, $test)

运行原子测试并输出其状态的函数。

参数
命令行标志

由于测试运行器是纯PHP,所以在CI管道或其他构建系统中使用时,主要测试过程需要以错误码退出。Tapping具有内置的此功能。

通过在脚本调用时提供脚本标志,例如。

$ php test.php --build

测试运行将在第一个测试失败时退出整个过程,返回码为-1

触发此类行为的标志别名是--build-b

除了构建标志外,还可以提供--quiet(简写为-q)标志来抑制失败信息(文件、行和发生错误)。

todo($description)

用于显示尚未编写的测试用例的注释。作为提醒或笔记等。

参数

$t

$t参数是一个用于预测和类似功能的容器。

预测

许可证

GPL-2.0 © Willi Eßer, Felix Buchheim