为什么是&;predispatch&;在Zend框架控制器上的PhpUnit集成测试中没有达到


Why is "preDispatch" not being reached in my PhpUnit integration tests on Zend Framework controller?

我有一个indexcontroller扩展MyCustom_Controller_Action,它扩展Zend_Controller_Action。

我注意到我的集成测试(当我做$this->dispatch('/')时)从未触发我的IndexController, MyCustom_Controller_Action或Zend_Controller_Action的preDispatch方法。然而,这些类的init()方法被调用。

我如何修复我的测试设置,使preDispatch函数也被调用(就像在我的生产应用程序的正常流中一样)?

(需要调用它们,否则我无法测试实际在应用程序中发生了什么)

PHPUnit) 3.5.15

Zend Framework 1.12

我错了。到达preDispatch函数

我最终通过Xdebug证明了这一点。我得到了Xdebug与Netbeans和Phpunit一起工作。我发现了一个超级有用的个性化步骤生成器。我创建了我的php.ini的匿名副本,并将其上传到http://xdebug.org/wizard.php,并按照所产生的步骤进行操作,现在我可以通过Mac终端运行如下内容:
php -dxdebug.remote_enable=1 -dxdebug.remote_host=127.0.0.1 -dxdebug.remote_autostart=On -dxdebug.remote_port=9001 -dxdebug.remote_mode=req /usr/local/opt/php55/bin/phpunit --filter testHeaderLocaleSwitchLoggedOut --bootstrap /code/master/tests/test.php --configuration /code/master/tests/phpunit.xml /code/master/tests/integration

然后Netbeans显示代码在断点处停止,并让我慢慢地逐步执行。