phpunit xml配置颜色指令不起作用

mig*_*eia 5 php phpunit unit-testing

我为我的单元测试定义了一个phpunit.xml配置文件.在这个文件中,我指示在单元测试结果中显示颜色如下:

<phpunit
   ... 
   colors="true"
   ... 
</phpunit>
Run Code Online (Sandbox Code Playgroud)

当我在命令行中运行测试时,一切正常,除了我在结果中没有绿色和红色.

如果我删除配置文件并--color=always在命令行中使用该参数,那么我将获得带有颜色的结果.

在配置文件中,我已经尝试更改colors="true"colors="always"没有结果.

我的配置文件有问题吗?

这是我的phpunit.xml配置文件:

<phpunit
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.1/phpunit.xsd"
  backupGlobals="true"
  backupStaticAttributes="false"
  cacheTokens="false"
  colors="true"
  convertErrorsToExceptions="true"
  convertNoticesToExceptions="true"
  convertWarningsToExceptions="true"
  forceCoversAnnotation="false"
  mapTestClassNameToCoveredClassName="false"
  printerClass="PHPUnit_TextUI_ResultPrinter"
  processIsolation="false"
  stopOnError="false"
  stopOnFailure="false"
  stopOnIncomplete="false"
  stopOnSkipped="false"
  stopOnRisky="false"
  testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
  timeoutForSmallTests="1"
  timeoutForMediumTests="10"
  timeoutForLargeTests="60"
  verbose="false">
 <testsuites>
   <testsuite name="examples">
     <directory>/home/miguelbgouveia/Documents/projects/joomla/tests</directory>
     <file>test_example.php</file>
   </testsuite>
 </testsuites>
</phpunit>
Run Code Online (Sandbox Code Playgroud)

phpunit的版本是5.1.2

Tra*_*ash 0

我通过删除该行解决了这个问题

printerClass="PHPUnit_TextUI_ResultPrinter"
Run Code Online (Sandbox Code Playgroud)

它看起来和以前一样,但是有颜色。希望这也能解决您的问题