You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让phpunit命令的测试输出拥有artisan test的样式(含测试时长等信息)

如何让phpunit命令的测试输出拥有artisan test的样式(含测试时长等信息)

我手头有个Laravel项目,里面写了不少单元测试。最近发现两个不同的测试命令输出样式差挺多的:

当我用 php vendor/bin/phpunit 跑测试时,输出是这样的:
phpunit测试结果

但换成 php artisan test 命令运行的话,输出就好看多了,还有测试时长这些实用信息:
artisan test测试结果

所以我想问:有没有办法让phpunit命令的测试输出也用上artisan test的那种样式?

我特别喜欢artisan test里显示的测试时长这类细节,但因为一些额外的日志需求,我只能用phpunit命令来执行测试,没法换成artisan test。


编辑补充:附上我的phpunit.xml配置片段:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd&...

备注:内容来源于stack exchange,提问作者Jeroen van Veghel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 10:49:39