Joseph:
Within an instance of Zend_Test_PHPUnit_ControllerTestCase:
...
public function appBootstrap()
{
$this->application = new Zend_Application(
APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'
);
$this->application->bootstrap();
$this->getFrontController()->setParam('bootstrap',
$this->application->getBootstrap());
}
...
You have to set the bootstrap param manually!
- jake
On Wed, Mar 24, 2010 at 1:02 PM, Joseph Crawford
<[email protected]> wrote:
>
> Hello Everyone,
>
> I have been working with Unit Testing in a ZF Application over the last few
> days and I have hit a problem. What I am wondering is if my
> application/Bootstrap.php file will be executed when testing. The reason I
> am asking is because I will want all of my custom routes to resolve
> properly. I also would like to find out if the Zend_Controller_Front is
> setup.
>
> In one of my test methods I am doing $bootstrap =
> Zend_Controller_Front::getInstance()->getParam('bootstrap'); and when I
> var_dump the $bootstrap variable I am getting back NULL.
>
> My directory structure for my application is the same as generated by
> Zend_Tool and my tests are in the following structure:
>
> /tests
> --/application
> ----/controllers
> ------/ControllerTest.php
> ----/models
> ------/ModelTest.php
> --/library
> ----/MyLib
> ------/FileTest.php
>
> I have created the bootstrap.php file which the phpunit.xml executes and I
> am using a class to actually setup the testing environment. All of my test
> cases extend from ControllerTestCase.php which looks like the following:
>
> class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
> {
> /**
> * @var Zend_Application
> */
> protected $application;
>
> public function setUp()
> {
> $this->bootstrap = array($this, 'appBootstrap');
> parent::setUp();
> }
>
> public function appBootstrap()
> {
> $this->application = new Zend_Application(
> OVISTORE_ENVIRONMENT,
> APPLICATION_PATH . '/configs/app.ini'
> );
> }
> }
>
> So I wonder with this setup is there anything I *have* to do in order to
> make the Zend_Controller_Front::getInstance()->getParam('bootstrap') not
> return NULL?
>
> Thanks,
> Joseph Crawford
> --
> View this message in context:
> http://n4.nabble.com/Unit-Testing-with-Zend-Test-tp1680861p1680861.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>