【发布时间】:2013-07-04 11:09:04
【问题描述】:
我编写了一个带有 Auth 模块的 ZF2 应用程序。此 Auth 模块的设置在其 Module.php 文件中完成。
我在 Zend Framework 2 单元测试教程 (http://framework.zend.com/manual/2.2/en/tutorials/unittesting.html) 中设置了一个测试,但要测试应用程序模块。在测试的 bootstrap.php 中,我只在配置中包含 Application 模块:
$config = array(
'module_listener_options' => array(
'module_paths' => $zf2ModulePaths,
),
'modules' => array(
'Application',
)
);
在 phpunit.xml 中我只包含了这个测试目录:
<phpunit bootstrap="Bootstrap.php">
<testsuites>
<testsuite name="myApplication">
<directory>./ApplicationTest</directory>
</testsuite>
</testsuites>
</phpunit>
我不希望加载 Auth 模块,因此应该禁用它以进行测试。但是我得到了一个 Auth 模块中的函数抛出的异常,所以我认为它无论如何都被加载了。
我是否误解了引导,有没有办法阻止该模块被加载?
【问题讨论】:
标签: php zend-framework phpunit zend-framework2