Quantcast

Problems with getting Zend_Test correctly working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Problems with getting Zend_Test correctly working

Koen-14
Hi All,

I forced myself to start writing unit tests (which I thought was the hardest part), but trying to getting it work properly seems a bit harder :)

I'm trying to get it working for an existing ZF 1.9.2 project. For that project I'm using Zend_Application to bootstrap everything in a Bootstrap.php file and some things in an ini file, like:
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
resources.frontController.controllerDirectory.default = APPLICATION_PATH "/default/controllers"
resources.frontController.controllerDirectory.cms = APPLICATION_PATH "/cms/controllers"

In my tests folder I have a TestHelper.php which sets some constants and includes paths and initializes Zend_Loader_Autoloader.
I have a separate bootstrap.php file containing:
// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/config/config.ini'
);

$bootstrap = $application->bootstrap()->getBootstrap();
$bootstrap->bootstrap();

In the test file 'controllers/IndexControllerTest.php' I require TestHelper.php and the public property $bootstrap contains: 'bootstrap.php'.

When running 'phpunit --verbose controllers\IndexControllerTest.php' it just seems to die. When commenting the 2 layout entries out in the ini file (resources.layout.layout, see above) it continues correctly, but a plugin fails, because the layout cannot be requested from the bootstrap...

Why can't the layout be set in the bootstrap (via .ini) for testing controllers? Does someone have a solution for this?

Thanks in advance.

- Koen
Loading...