PHPStorm + PHPUnit颜色输出 [英] PHPStorm + PHPUnit Color output

查看:194
本文介绍了PHPStorm + PHPUnit颜色输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有在PHPStorm 7.1中运行的PHPUnit,但是我无法找到如何在测试中使用ANSI颜色代码的方法.我的PHPunit.xml在属性列表中有colors = "true",但是每次我尝试类似的操作时:

So I have PHPUnit running in PHPStorm 7.1, but I can't find out how to get the ANSI color codes working from within tests. My PHPunit.xml has colors = "true" in the property list, but every time I try something like:

echo "\033[31mError! Error!\033[0m\n";

在我的一个测试用例中,它只是给我:

Inside one of my test cases, it just gives me:

[31mError! Error![0m

在PHPstorm phpunit输出中的

.在PHPStorm的测试中使用ANSI颜色代码时,有什么方法可以使颜色正确显示?

in the PHPstorm phpunit output. Is there any way to make the colors appear properly when using ANSI color codes in tests in PHPStorm?

推荐答案

PhpStorm具有特殊的集成脚本来运行PHPUnit测试(所有消息/进度指示器都已转移到GUI部分,您可以在其中轻松查看已通过哪些测试以及未通过哪些测试等).

PhpStorm has special integration script to run PHPUnit tests (all messages/progress indicators are transferred into GUI part where you can easily see what tests have passed and what did not etc).

PhpStorm的控制台不支持ANSI颜色- http://youtrack.jetbrains.com/issue /IDEA-69880 和相关票证.

PhpStorm's console does not support ANSI colors -- http://youtrack.jetbrains.com/issue/IDEA-69880 and related tickets.

但是您可以安装 Grep Console插件,它将添加对ANSI颜色的支持(需要在设置"中激活).我已经使用PHPUnit进行了尝试,并且可以正常工作-并非所有内容都是彩色的(某些代码无法识别,但大多数都可以使用).您可以根据需要与插件作者联系,而不需要工作.

But you can install Grep Console plugin and it will add support for ANSI colors (needs to be activated in Settings). I have tried it with PHPUnit and it worked -- not everything was colored (some of the codes were not recognized, but most worked). You can contact plugin author with not working parts if desired.

这篇关于PHPStorm + PHPUnit颜色输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆