Issues

ZF-7839: Support or document Zend_Application_Bootstrap usage in Zend_Test_PHPUnit_ControllerTestCase

Issue Type:

Improvement

Created:

2009-09-13T12:53:24.000+0000

Last Updated:

2009-10-16T13:24:50.000+0000

Status:

Resolved

Fix version(s):

1.9.5 (27/Oct/09)

Reporter:

Duo Zheng (duoduo)

Assignee:

Matthew Weier O'Phinney (matthew)

Tags:

Zend_Test_PHPUnit

Related issues:

Attachments:

Description

I would like to see the "standard" Zend Framework bootstrapping method to be supported in Zend_Test_PHPUnit_ControllerTestCase. It is confusing and not obvious on how to reuse your Zend_Application_Bootstrap when using the ControllerTestCase.

There are 2 ways that this can be done.

------ First Method ------

Document with code examples on how to use Zend_Application_Bootstrap_* in the Zend_Test_PHPUnit_ControllerTestCase manual. However one issue is that it feels a bit weird as you have to overwrite $this->_frontController manually yourself.

if $this->bootstrap is set to an instance of Zend_Application then have the ControllerTestCase automatically call $bootstrap->bootstrap() for you. Future calls to $this->getFrontController() will retrieve the frontController from the bootstrap instead.

This is a simplified example obviously and I may have missed some details, but it seems obvious for some kind of support of the "standard" bootstrapping method. Bootstrapping can be very lengthy/complex and since the main goal is re-usability why would we want to have a completely different bootstrap method (or duplicated) for controller testing. I think this improvement will "sync" Zend_Test_PHPUnit_ControllerTestCase with the encouraged bootstrap method. This also puts to great use the separate production , development, testing ini settings document in the Zend_Application quick start. It becomes even more important with all the plugins with preDispatch details...etc. I think you get the point :).