dan-da / tester-php
此包最新版本(v1.0.5)没有提供许可证信息。
v1.0.5
2019-10-13 22:38 UTC
Requires
- dan-da/strictmode-php: ^1.0
README
一个简单的单文件PHP测试工具。
这是一个非常轻量级的测试工具,可以使用composer轻松安装,或者您可以将tester.php文件复制到自己的项目中。
让我们看一个示例测试。
测试在eq.test.php文件中。
<?php
namespace tester;
class eq extends test_base {
public function runtests() {
$this->test1();
}
protected function test1() {
$this->eq( 1, "1.00", 'one' );
$this->eq( 2, "2.00", 'two' );
}
}
现在让我们执行它。
$ ../tester.php
Running tests in eq...
[pass] 1 == 1.00 | one
[pass] 2 == 2.00 | two
2 tests passed.
0 tests failed.
用法
tester.php [testfilename]
By default, all files matching *.test.php in current directory will be run.
安装和运行。
库安装
通常您会使用项目中的composer.json文件中的composer require将tester-php安装到自己的项目中,例如
"require": {
"dan-da/tester-php"
}
然后运行composer install。
tester.php文件现在在/vendor/bin/tester.php可用。
独立安装
git clone https://github.com/dan-da/hd-wallet-derive
cd hd-wallet-derive
php -r "readfile('https://getcomposer.org.cn/installer');" | php
php composer.phar install
运行测试。
$ cd tests
$ ../tester.php
待办事项
- 添加更多示例测试用例
- 添加适当的帮助/用法。