ZF-6419: Zend_Tool's public/index.php doesn't work with Zend_Application
Description
The index.php generated by Zend_Tool (trunk revision 15149) generates the following code:
$application->bootstrap()
->run();
Unfortunately, Zend_Application::bootstrap() is defined as:
public function bootstrap()
{
$this->getBootstrap()->bootstrap();
}
Either Zend_Application::bootstrap() should {{return $this;}} or Zend_Tool should generate code like this:
$application->bootstrap()
$application->run();
Comments
Posted by Rob Allen (rob) on 2009-04-25T08:54:50.000+0000
Attached suggested patch:
Index: tests/Zend/Application/ApplicationTest.php =================================================================== --- tests/Zend/Application/ApplicationTest.php (revision 15149) +++ tests/Zend/Application/ApplicationTest.php (working copy) @@ -319,6 +319,12 @@ $application = new Zend_Application('testing', $config->toArray()); $this->assertTrue($application->hasOption('foo')); } + + public function testBootstrapReturnsTheZendAppplicationInstance() + { + $application = $this->application->bootstrap(); + $this->assertEquals($application, $this->application); + } } if (PHPUnit_MAIN_METHOD == 'Zend_Application_ApplicationTest::main') { Index: library/Zend/Application.php =================================================================== --- library/Zend/Application.php (revision 15149) +++ library/Zend/Application.php (working copy) @@ -285,11 +285,12 @@ /** * Bootstrap application * - * @return void + * @return Zend_Application */ public function bootstrap() { $this->getBootstrap()->bootstrap(); + return $this; } /**Posted by Rob Allen (rob) on 2009-04-25T12:53:40.000+0000
Fixed by Mattthew in r15150 on trunk and r15151 on release-1.8