我必须在Laravel 5.7中使用phpunit进行运行测试时按Enter。
在每次测试中,我都会收到以下消息:
1)测试\功能\部门测试:: a_admin_can_create_a_department Mockery \ Exception \ BadMethodCallException:已收到 Mockery_1_Illuminate_Console_OutputStyle :: askQuestion(),但没有 期望已指定
通过将以下设置为false,错误消失:
$ ./optparse-sub-example create --global-flag HI
Created the thing named HI
global flag: True
$ ./optparse-sub-example --global-flag create HI
Created the thing named HI
global flag: True
$ ./optparse-sub-example --global-flag delete
Deleted the thing!
global flag: True
$ ./optparse-sub-example delete --global-flag
Deleted the thing!
global flag: True
$ ./optparse-sub-example delete
Deleted the thing!
global flag: False
$ ./optparse-sub-example delete --version
0.0
$ ./optparse-sub-example create --version
0.0
之后,该窗口将停止运行测试套件,我需要按Enter键才能运行测试。
我该如何解决?
我使用Windows 10 + PHPUnit 7.5.1和Laravel 5.7.19
谢谢!
public $mockConsoleOutput = false;
答案 0 :(得分:0)
所以现在我终于找到了解决方法。
在我从Laravel 5.1迁移到Laravel 5.2(很久以前)的时候,我忘记在config / app.php文件中添加以下行:
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
现在一切正常。
丹尼尔问候
答案 1 :(得分:0)
这为我解决了问题 https://stackoverflow.com/a/48303288/2171254
这样做之后,我不需要行public $mockConsoleOutput = false;
问候