使用PHPUnit,如何仅测试两个或更多组?

bit*_*gic 16 php testing

在PHPUnit的帮助中,它显示以下内容:

  --group ...              Only runs tests from the specified group(s).
  --exclude-group ...      Exclude tests from the specified group(s).
Run Code Online (Sandbox Code Playgroud)

对于一组来说足够容易.这有效:

phpunit --group fast
Run Code Online (Sandbox Code Playgroud)

现在,我无法弄清楚如何使用多个组来完成此操作.以下内容对我不起作用:

phpunit --group fast unit   # It believes you want to test unit.php
phpunit --group fast, unit  # It believes you want to test unit.php
phpunit --group "fast unit" # It looks for a single group "fast unit"
phpunit --groups fast, unit # There is no option, groups
phpunit --group fast --group unit   # Only one is honored
Run Code Online (Sandbox Code Playgroud)

任何关于正确语法的想法都会受到欢迎.谢谢.

bor*_*ble 29

使用逗号分隔,不带任何空格.例如

phpunit --group fast,unit
Run Code Online (Sandbox Code Playgroud)


Ada*_*ear 6

试试phpunit --group "fast, unit"phpunit --group fast,unit.

命令行参数在空格上分割,因此您必须将值包装在双引号中或省略空格.