laravel - 我必须在 laravel 中使用 phpunit 运行测试时按 Enter
问题描述
我必须在 Laravel 5.7 中使用 phpunit 运行测试时按 Enter 键。
在每次测试中,我都会收到以下消息:
1) Tests\Feature\DepartmentsTest::a_admin_can_create_a_department Mockery\Exception\BadMethodCallException: Received Mockery_1_Illuminate_Console_OutputStyle::askQuestion(),但未指定预期
通过将以下设置为false,错误消失:
public $mockConsoleOutput = false;
之后,窗口挂起运行测试套件,我需要按 Enter 键运行测试。
我该如何解决?
我正在使用 Windows 10 + PHPUnit 7.5.1 和 Laravel 5.7.19
提前致谢!
/** @test */
public function a_admin_can_create_a_department()
{
// $this->withoutExceptionHandling();
$attributes = [
'description' => 'Service',
'accessible_by_depart' => true
];
$this->post('/tools/api/storeDepartment', $attributes);
$this->assertDatabaseHas('departments', $attributes);
}
解决方案
这为我解决了问题 https://stackoverflow.com/a/48303288/2171254
之后,我不需要这条线public $mockConsoleOutput = false;
问候
推荐阅读
- android - 如何在 Android 上使用按钮停止语音识别?
- python - 每次在绘图选项卡 spyder IDE 中运行代码时清除所有 seaborn 绘图
- php - 变量未检测为变量
- python - 排序后更新 Pandas 索引
- java - 在java中找到两个集合中的唯一点和共同点,而不使用任何集合、列表等
- angular - 如何使用 RxJS 在后台执行 HTTP 请求
- javascript - Firestore Cloud 函数使用属性中的变量来更新文档
- processing - 如何在贝塞尔曲线中添加渐变?
- c++ - 在 C++ 中访问 int 映射到类对象时出错
- c# - 安装部署到 Microsoft Store 的 WPF .net Core 3.1 应用程序时出错