PHPUnit 怎样设置测试文件加载的顺序?

比如测试目录下有两个文件:
aTest.php
bTest.php

我希望它先加载 bTest.php ,再加载 aTest.php

按文档上说,只需要在 phpunit.xml 中指定即可:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./Index/base.php">
  <testsuites>
    <testsuite name="mytest">
      <file>./Index/bTest.php</file>
      <file>./Index/aTest.php</file>
    </testsuite>
  </testsuites>
</phpunit>

但当我运行

phpunit Index -v

时,提示使用了这个 phpunit.xml 文件,但加载文件的顺序并不是我指定的,怎么回事?

(我在 aTest.php 中需要依赖 bTest.php 某个测试方法的返回值。)

阅读 2.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题