2

配置选项在最新版本的文档 bootstrap中被注释掉了: http ://www.phpunit.de/manual/current/en/appendixes.configuration.htmlphpunit.xml

事实上,它似乎没有在我的配置文件中读取它。为什么是这样?如何配置 phpunit 3.6 以自动包含引导文件?

在我看来,设置您的项目非常有用,因此 PHPUnit 会自动配置引导文件,而运行 PHPUnit 的人不必知道它,所以他们可以简单地做:

> phpunit

而不是:

> phpunit --bootstrap [file]
4

2 回答 2

0

引导文件应在测试之前运行,它是 phpunit 的可用命令行选项

--bootstrap <file>

有关 cli 选项的更多信息:

http://www.phpunit.de/manual/current/en/textui.h​​tml#textui.clioptions

我从来没有将 xml 配置文件用于引导选项,所以我不知道为什么它不工作或不再工作,但希望 cli 像它对我一样工作:)

于 2012-05-02T17:19:10.263 回答
0

在 PHPUnit 的配置文件中,3.4您可以在版本中包含一个引导文件,如下所示:

<phpunit backupGlobals="false"
         backupStaticAttributes="true"
         bootstrap="/path/to/bootstrap.php"

http://www.phpunit.de/manual/3.4/en/appendixes.configuration.html

但是由于3.5此选项已被注释掉,因此您不能再使用它:

<phpunit backupGlobals="true"
         backupStaticAttributes="false"
         <!--bootstrap="/path/to/bootstrap.php"-->

http://www.phpunit.de/manual/3.5/en/appendixes.configuration.html

我找不到任何关于为什么禁用此选项的参考。我查找了 PHPUnit 的发行说明,3.5看看他们是否提到了任何内容,但我发现根本没有提到引导程序。

http://sebastian-bergmann.de/archives/897-PHPUnit-3.5.html

https://github.com/sebastianbergmann/phpunit/blob/3.5/README.markdown

我仍然欢迎任何知道为什么删除此选项的人发表评论。

于 2012-09-05T13:54:11.590 回答