Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.8.0
-
Component/s: Zend_Application
-
Labels:None
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();
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; } /**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; } /**