让PHPUnit忽略了什么?

我有一个 PHPUnit Test类,我想在测试运行中忽略它.我知道我可以通过重命名它来使它在文件名中不包含单词Test,但我宁愿不这样做,因为它比我想要的更多地混淆了源代码控制水域.

有没有人有建议?

PHPunit命令有几个选项可以帮助定义应该和不应该运行哪些测试:
$PHPunit --help
PHPUnit 3.4.0beta5 by Sebastian Bergmann.

Usage: PHPunit [switches] UnitTest [UnitTest.PHP]
       PHPunit [switches] <directory>
...
  --filter <pattern>       Filter which tests to run.
  --group ...              Only runs tests from the specified group(s).
  --exclude-group ...      Exclude tests from the specified group(s).
  --list-groups            List available test groups.
...

那些可能不会准确指出你想要的……但他们可能会有所帮助.

有关更多详细信息,请参阅The Command-Line Test Runner

特别是,我有点像组功能:只需在测试的PHPdoc中使用@group标签,重新组合它们(例如,每个“功能块”一组);然后,您可以在命令行上使用–group或–exclude-group选项来指定应该或不应该运行哪些测试.

在您的情况下,如果您无法修改测试,也许–filter选项可以提供帮助,具体取决于您的测试被命名的方式(即,是否有办法识别您想要运行的测试):

--filter

Only runs tests whose name matches the given pattern. The pattern can be
either the name of a single test or a
regular expression that matches
multiple test names.

另一种解决方案,如果您并不总是更改要运行的测试的“组”,可能是使用仅包含您要运行的测试的测试套件.

例如,看看Composing a Test Suite Using XML Configuration.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...