2008年7月25日星期五

Re: [fw-mvc] Using routes in Zend_Test

-- Емил Иванов / Emil Ivanov <emil.vladev@gmail.com> wrote
(on Friday, 25 July 2008, 03:27 PM +0300):
> I'm trying to use the new Zend_Test and it's bootstraping facility.
>
> The problem is that I use the url helpers in my tests since I use only
> named routes, but the router is being set up in a front controller
> plugin.
> So when I try to use routes in tests - they are not yet defined.
> The bootstraping is also done in a plugin.
>
> Any suggestions are welcome.

You don't have to use a plugin to bootstrap; it was just one example
used in the manual. You can also:

* Do all bootstrapping in a file, and specify this file to the
$bootstrap property of the test case. If you do this, make sure that
you do not call dispatch().

* Create a method that does all your bootstrapping, and assign a
callback to this method. This would work essentially the same as the
examples in the manual, except that you would do more than assign a
single plugin, you'd do your entire application bootstrapping.

BTW, the plugin I suggested in the manual would operate at
routeStartup() -- which allows you to assign routes prior to routing,
making it another viable option.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: