【发布时间】:2016-08-19 07:55:13
【问题描述】:
我正在使用以下指令运行代码接收测试:
$I->runShellCommand('php artisan <custom command>');
artisan 命令当前抛出 PHP 致命错误,因为找不到类。没事儿。我知道如何解决它。但是,codeception 并没有发现命令失败。测试在不应该通过时通过。
注意几点:
- 当我直接在 shell 中运行 custom artisan 命令时,退出代码是 255
-
使用
$I->runShellCommand('php artisan <custom command>'); $I->seeInShellOutput('error');`消息失败
Step I see in shell output "error" Fail Failed asserting that '' contains "error".(为什么当命令产生错误时,codeception 没有看到任何输出?)
-
使用
$I->runShellCommand('php artisan up'); $I->seeInShellOutput('error');按预期失败并显示消息
Step I see in shell output "error" Fail Failed asserting that 'Application is now live.' contains "error".(Codeception 显然看到了一个没有出错的命令的输出。)
当我在Codeception源代码中找到runShellCommand方法并在方法中添加
die(var_dump($resultCode))时,我看到codeception看到的结果代码实际上是0。那么为什么Codeception没有看到致命错误当我直接运行命令时我会做什么?
知道这里发生了什么吗?如果由于 PHP 致命错误导致 artisan 命令失败,如何让我的 artisan 命令测试失败?
【问题讨论】:
标签: laravel codeception laravel-artisan