Browse Source

ZF-6618: apply patch allowing Zend_Application::bootstrap() to accept a resource name

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18281 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 years ago
parent
commit
37618d355b
2 changed files with 20 additions and 2 deletions
  1. 3 2
      library/Zend/Application.php
  2. 17 0
      tests/Zend/Application/ApplicationTest.php

+ 3 - 2
library/Zend/Application.php

@@ -339,11 +339,12 @@ class Zend_Application
     /**
      * Bootstrap application
      *
+     * @param  null|string|array $resource
      * @return Zend_Application
      */
-    public function bootstrap()
+    public function bootstrap($resource = null)
     {
-        $this->getBootstrap()->bootstrap();
+        $this->getBootstrap()->bootstrap($resource);
         return $this;
     }
 

+ 17 - 0
tests/Zend/Application/ApplicationTest.php

@@ -436,6 +436,23 @@ class Zend_Application_ApplicationTest extends PHPUnit_Framework_TestCase
         ));
         $this->assertEquals('baz', $application->getOption('FooBar'));
     }
+
+    /**
+     * @group ZF-6618
+     */
+    public function testCanExecuteBoostrapResourceViaApplicationInstanceBootstrapMethod() {
+        $application = new Zend_Application('testing', array(
+            'bootstrap' => array(
+                'path' => dirname(__FILE__) . '/_files/ZfAppBootstrap.php',
+                'class' => 'ZfAppBootstrap'
+                )
+            )
+        );
+        $application->bootstrap('foo');
+
+        $this->assertEquals(1, $application->getBootstrap()->fooExecuted);
+        $this->assertEquals(0, $application->getBootstrap()->barExecuted);
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Application_ApplicationTest::main') {