[limb-svn] r7097 - in 3.x/trunk/limb/web_app: src/filter tests/cases/plain/filter

svn at limb-project.com svn at limb-project.com
Tue Jul 8 10:09:25 MSD 2008


Author: conf
Date: 2008-07-08 10:09:25 +0400 (Tue, 08 Jul 2008)
New Revision: 7097
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7097

Modified:
   3.x/trunk/limb/web_app/src/filter/lmbRequestDispatchingFilter.class.php
   3.x/trunk/limb/web_app/tests/cases/plain/filter/lmbRequestDispatchingFilterTest.class.php
Log:
-- fixed bug with empty request in controller constructor (supplied test needs to be fixed)


Modified: 3.x/trunk/limb/web_app/src/filter/lmbRequestDispatchingFilter.class.php
===================================================================
--- 3.x/trunk/limb/web_app/src/filter/lmbRequestDispatchingFilter.class.php	2008-07-07 11:13:09 UTC (rev 7096)
+++ 3.x/trunk/limb/web_app/src/filter/lmbRequestDispatchingFilter.class.php	2008-07-08 06:09:25 UTC (rev 7097)
@@ -37,6 +37,8 @@
 
     $dispatched_params = $this->dispatcher->dispatch($toolkit->getRequest());
 
+    $this->_putOtherParamsToRequest($dispatched_params);
+    
     $controller = $this->_createController($dispatched_params);
 
     if(isset($dispatched_params['action']) && $controller->actionExists($dispatched_params['action']))
@@ -48,8 +50,6 @@
 
     $toolkit->setDispatchedController($controller);
 
-    $this->_putOtherParamsToRequest($dispatched_params);
-
     $filter_chain->next();
   }
 

Modified: 3.x/trunk/limb/web_app/tests/cases/plain/filter/lmbRequestDispatchingFilterTest.class.php
===================================================================
--- 3.x/trunk/limb/web_app/tests/cases/plain/filter/lmbRequestDispatchingFilterTest.class.php	2008-07-07 11:13:09 UTC (rev 7096)
+++ 3.x/trunk/limb/web_app/tests/cases/plain/filter/lmbRequestDispatchingFilterTest.class.php	2008-07-08 06:09:25 UTC (rev 7097)
@@ -23,6 +23,8 @@
   {
     $this->name = $name;
     parent :: __construct();
+    
+    $this->param = $this->request->get('param', null);
   }
   
   function doDisplay()
@@ -124,7 +126,7 @@
     $this->assertDispatchedOk($controller, $controller->getDefaultAction(), __LINE__);
   }
 
-  function testUse404ControllerIsNoSuchActionInDispatchedController()
+  function testUse404ControllerIfNoSuchActionInDispatchedController()
   {
     $dispatched_params = array('controller' => $controller_name = 'SomeController',
                                'action' => 'no_such_action');
@@ -193,7 +195,20 @@
     $this->assertEqual($this->request->get('id'), 150);
     $this->assertEqual($this->request->get('extra'), 'bla-bla');
   }
+  
+  function testIsRequestAvailableInControllerConstructor() 
+  {
+    $dispatched_params = array('controller' => 'SomeController',
+                               'param' => 150);
 
+    $controller = new lmbRequestDispatchingTestingController('SomeController');
+    $this->_setUpMocks($dispatched_params, $controller);
+
+    $this->filter->run($this->chain);
+
+    $this->assertEqual($controller->param, $dispatched_params['param']);
+  }
+
   function assertDispatchedOk($controller, $action, $line)
   {
     $dispatched_request = $this->toolkit->getDispatchedController();



More information about the limb-svn mailing list