ailixter / aiixtest
此包最新版本(dev-master)没有可用的许可证信息。
测试代码片段运行器。
dev-master
2020-10-29 12:15 UTC
Requires
- php: >=5.3
This package is auto-updated.
Last update: 2024-09-26 18:58:47 UTC
README
PHP 测试代码片段运行器
是的,“代码片段”确实是指代码片段。 任何有效的 PHP 文件 都可以运行,其 $vars 将被打印,其返回值将被记住并进行分析。
安装
$ git clone https://github.com/ailixter/aiixtest.git
cd aiixtest
$ php aiixtest.php
或者
$ php composer require-dev ailixter/aiixtest
$ ./vendor/bin/aiixtest.php
示例
o==============================================================================o
| test/argv.php |
o==============================================================================o
1| <?php
2|
3|
4| global $argv;
5| reset($argv);
6| while (($arg = next($argv)) !== false) {
7| $array[] = $arg;
8| }
9|
10| return "new return";
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
RETURNED: string(10) "new return"
EXPECTED: int(1)
--------------------------------------------------------------------------------
Vars after:
shared $array: array (
0 => 'php',
);
$argv: array (
0 => 'C:\\Work\\php\\aiixtest\\aiixtest.php',
1 => 'php',
);
$arg: false;
只需要一个测试目录,其结构如下
my-tests
|
\-init
| |
| \-(initialization files)*
|
\-test
|
\-(test files)+
然后可以使用以下命令开始测试
$ cd my-project
$ php aiixtest.php my-tests
更多信息请参阅 Wiki