Ver Fonte

ZF-6519: backporting r15319 to trunk

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15320 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew há 16 anos atrás
pai
commit
3cf861dff8

+ 2 - 2
library/Zend/Application/Resource/Modules.php

@@ -57,8 +57,8 @@ class Zend_Application_Resource_Modules extends Zend_Application_Resource_Resour
     public function init()
     {
         $bootstrap = $this->getBootstrap();
-        $bootstrap->bootstrap('frontcontroller');
-        $front = $bootstrap->frontController;
+        $bootstrap->bootstrap('FrontController');
+        $front = $bootstrap->getResource('FrontController');
 
         $modules = $front->getControllerDirectory();
         $default = $front->getDefaultModule();

+ 10 - 0
tests/Zend/Application/Resource/FrontcontrollerTest.php

@@ -241,6 +241,16 @@ class Zend_Application_Resource_FrontcontrollerTest extends PHPUnit_Framework_Te
             $this->assertTrue($front->hasPlugin($class));
         }
     }
+
+    public function testShouldReturnFrontControllerWhenComplete()
+    {
+        require_once 'Zend/Application/Resource/Frontcontroller.php';
+        $resource = new Zend_Application_Resource_Frontcontroller(array(
+            'controllerDirectory' => dirname(__FILE__),
+        ));
+        $front = $resource->init();
+        $this->assertTrue($front instanceof Zend_Controller_Front);
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_FrontcontrollerTest::main') {

+ 15 - 0
tests/Zend/Application/Resource/ModulesTest.php

@@ -139,6 +139,21 @@ class Zend_Application_Resource_ModulesTest extends PHPUnit_Framework_TestCase
         $expected   = array('bar', 'foo');
         $this->assertEquals($expected, $test);
     }
+
+    public function testShouldReturnExecutedBootstrapsWhenComplete()
+    {
+        require_once 'Zend/Application/Resource/Modules.php';
+
+        $this->bootstrap->registerPluginResource('Frontcontroller', array(
+            'moduleDirectory' => dirname(__FILE__) . '/../_files/modules',
+        ));
+        $resource = new Zend_Application_Resource_Modules(array());
+        $resource->setBootstrap($this->bootstrap);
+        $bootstraps = $resource->init();
+        $test       = array_keys((array) $bootstraps);
+        $expected   = array('bar', 'foo');
+        $this->assertEquals($expected, $test);
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_ModulesTest::main') {