Browse Source

Fix for ZF-6747

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17016 44c647ce-9c0f-0410-b52a-842ac1e357ba
freak 16 years ago
parent
commit
623527b3ca

+ 1 - 1
library/Zend/Application/Resource/Navigation.php

@@ -102,7 +102,7 @@ class Zend_Application_Resource_Navigation
     protected function _storeHelper()
     {
         $this->getBootstrap()->bootstrap('view');
-        $view = $this->getBootstrap()->getPluginResource('view')->getView();
+        $view = $this->getBootstrap()->view;
         $view->getHelper('navigation')->navigation($this->getContainer());
     }
 

+ 14 - 0
tests/Zend/Application/Resource/NavigationTest.php

@@ -139,6 +139,20 @@ class Zend_Application_Resource_NavigationTest extends PHPUnit_Framework_TestCas
         $this->assertEquals($number,1);
 		$this->bootstrap->unregisterPluginResource('view');
     }
+    
+    /**
+	 * @group ZF-6747
+	 */
+    public function testViewMethodIsUsedWhenAvailableInsteadOfResourcePlugin()
+    {
+        require_once '_files/ZfAppBootstrapCustomView.php';
+    
+    	$bootstrap = new ZfAppBootstrapCustomView($this->application);
+    	$bootstrap->registerPluginResource('view');
+ 		$view = $bootstrap->bootstrap('view')->view;
+ 		
+ 		$this->assertEquals($view->setInMethodByTest,true);
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_LocaleTest::main') {

+ 9 - 0
tests/Zend/Application/Resource/_files/ZfAppBootstrapCustomView.php

@@ -0,0 +1,9 @@
+<?php
+class ZfAppBootstrapCustomView extends Zend_Application_Bootstrap_Bootstrap {
+    public function _initView()
+    {
+		$view = new Zend_View();
+		$view->setInMethodByTest = true;
+		return $view;
+    }
+}