有人可以解释一下在使用PHPunit配置文件时,phpunit.xml.dist
和phpunit.xml
之间的区别吗?
官方文档中提到了这两个名称:
PHPUnit的XML配置文件(附录C)也可用于组成测试套件。示例5.1展示了一个最小的phpunit.xml文件,当递归遍历tests目录时,将添加所有在* Test.php文件中找到的* Test类。
如果没有使用configuration
参数,则会给phpunit.xml
加载配置文件时赋予更高优先级。
I did find some questions (e.g. is this .xml.dist file really required to be used) relating to the fact, that如果当前工作目录中存在phpunit.xml或phpunit.xml.dist(按照此顺序),并且未使用--configuration,则自动从该文件中读取配置。
.dist
files usually are used as a template (distribution) which should be copied to a version without the .dist
ending to activate them (e.g. .htaccess.dist
). But this seems not to be the case with PHPunit as it picks up and runs the dist file as well. Other questions (Can I use phpunit.xml for credentials and phpunit.xml.dist for testsuites?) seem to deal with other weird usage ideas about these two files.在Symfony世界中,包含一个
phpunit.xml.dist
文件是强制性的用于可重用的bundles,我想知道为什么不使用phpunit.xml
文件。一个测试套件不应包含AllTests.php脚本,而必须依赖于phpunit.xml.dist文件的存在。
所以如果有人能对此进行解释,我会很高兴;-)