开发者

Workarounds For Phpunit's Incorrect File Sorting?

Anyone know of a workaround for Phpunit's illogical file sorting? I've got tests in a subfolder with names like "AddMin001.php", "...002.php", etc. and Phpunit insists on running 002, 003开发者_如何学运维, 004, then 001.

My attempts to use Phpunit.xml always produce: "Uncaught exception 'PHPUnit_Framework_Exception' with message 'Could not load "[redacted]phpunit.xml".' in /usr/share/php/PHPUnit/Util/XML.php:212".

Creating AllTests.php classes seems like a lot of extra work and maintenance, but if necessary I'll go that route.


PHPUnit does not sort tests at all, they are run in whatever order your filesystem is returning them. Could be creation date, could be something else, depends on the filesystem (and OS) in use. In any case, you can not rely on this order, because factors outside your tests can change it.

There are however a few tricks, that you could use - for example test dependencies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜