当尝试这个命令时 docker-compose exec app php ./vendor/bin/phpunit
或容器内,如 /vendor/bin/phpunit
结果就像。
PHPUnit 8.5.4 by Sebastian Bergmann and contributors.
..F..FFFEE
虽然我需要 更多详情 比如测试时间和失败信息,我可以通过启用以下功能来获得一些信息 stopOnFailure = true
但这并不理想,因为它停在第一条上,但我需要所有的测试运行并看到结果。
我需要这样的东西。
PHPUnit 8.5.4 by Sebastian Bergmann and contributors.
.......................E....................................... 63 / 116 ( 54%)
..................................................... 116 / 116 (100%)
Time: 1.2 minutes, Memory: 48.50 MB
There was 1 error:
ERRORS!
Tests: 116, Assertions: 219, Errors: 1.
因为你使用的是docker,所以默认情况下,显示错误的php.ini配置是禁用的。
解决方法1.更新你的docker的PHP配置。
更新docker的PHP配置。
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
通过参考 https:/stackoverflow.coma40120445494907。
解决方案2:
连接一个 bootstrap
卷入 phpunit.xml
作为
<phpunit bootstrap="init.php">
在phpunit.xml目录下创建init.php。
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');