md / eris-runner
此包最新版本(0.1.0)没有可用的许可证信息。
0.1.0
2017-08-28 09:31 UTC
Requires
- giorgiosironi/eris: ~0.7
- phunkie/phunkie: ^0.8
This package is not auto-updated.
Last update: 2024-09-15 03:03:33 UTC
README
Eris Runner 是 Eris 的测试运行器 Eris
使用此运行器,您不需要额外的测试框架来运行基于属性的测试。
您只需要一个目录或一个具有以下属性编写的文件
<?php property ("strings have the same length in reverse", function() { forAll (Gen::string()) (function ($s) { Assert::same(strlen($s), strlen(strrev($s))); }); }); property ("positive integers squared are always bigger than themselves", function() { forAll (Gen::integer()) // ok zero * zero is still zero ->when (function($x) { return $x > 0; }) ->then (function ($x) { // Should fail! Did you think about 1? ;-) Assert::greaterThan($x * $x, $x); }); });
然后只需调用运行器以运行 tests
文件夹中的所有测试
$ bin/eris tests
或单个 PHP 文件
$ bin/eris my_test.php
请注意,Eris Runner 允许您使用 Webmozart 的 Assert 库 作为断言。但您可以使用任何您喜欢的。只需确保您抛出一些异常即可。