quarkdev/tendo

v0.1.1 2016-04-25 00:10 UTC

This package is auto-updated.

Last update: 2024-09-20 12:20:26 UTC


README

Tendo 是一个受 Ava 启发的非常简单的测试框架。

如何运行

composer require 'quarkdev/tendo'

示例

<?php
use Tendo\Tendo;

require 'vendor/autoload.php';

$test = new Tendo();

$test('title', function($t) {
    $t->pass(); // yes
});

$test('title 2', function($t) {
    $t->is(123, '123'); // nop
});

$test('Plan', function($t) {
    $t->plan(2);

    for ($i = 0; $i < 3; $i++) {
        $t->true($i < 3);
    }
}); // fails, 3 assertions are executed which is too many

$test->results();

命令行示例

变量 $test 会自动注入,您不需要实例化 Tendo。

使用 myTest.php 的示例

<?php
$test('title', function($t) {
    $t->pass(); // yes
});

$test('title 2', function($t) {
    $t->is(123, '123'); // nop
});

您现在可以通过命令行运行测试

./vendor/bin/tendo myTest.php

注意:您可以通过命令行运行多个测试 ./vendor/bin/tendo test1.php test2.php ...