[limb-svn] r6502 - in 3.x/trunk/limb/web_app: src/controller tests/cases/plain/controller
svn at limb-project.com
svn at limb-project.com
Thu Nov 8 10:33:44 MSK 2007
Author: serega
Date: 2007-11-08 10:33:43 +0300 (Thu, 08 Nov 2007)
New Revision: 6502
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6502
Modified:
3.x/trunk/limb/web_app/src/controller/FallbackToViewController.class.php
3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php
3.x/trunk/limb/web_app/tests/cases/plain/controller/lmbControllerTest.class.php
Log:
-- lmbAbstractController :: _findTemplateByFormat() -> _findTemplateByAlias()
-- fixed a bug with finding template by alias if controller action name constains percentage symbol
-- fixed FallbackToViewController due to lmbAbstractController changes
Modified: 3.x/trunk/limb/web_app/src/controller/FallbackToViewController.class.php
===================================================================
--- 3.x/trunk/limb/web_app/src/controller/FallbackToViewController.class.php 2007-11-07 20:55:51 UTC (rev 6501)
+++ 3.x/trunk/limb/web_app/src/controller/FallbackToViewController.class.php 2007-11-08 07:33:43 UTC (rev 6502)
@@ -27,7 +27,7 @@
$toolkit = lmbToolkit :: instance();
$path = trim($toolkit->getRequest()->getUriPath(), '/');
- if($template_path = $this->_findTemplateByFormat($path . '%s'))
+ if($template_path = $this->_findTemplateByAlias($path))
{
$view = $this->toolkit->createViewByTemplate($template_path);
$this->toolkit->setView($view);
Modified: 3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php
===================================================================
--- 3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php 2007-11-07 20:55:51 UTC (rev 6501)
+++ 3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php 2007-11-08 07:33:43 UTC (rev 6502)
@@ -146,9 +146,9 @@
if(isset($this->action_template_map[$this->name]) && isset($this->action_template_map[$this->name][$action]))
return $this->action_template_map[$this->name][$action];
- $template_format = $this->getName() . '/' . $action . '%s';
+ $template_format = $this->getName() . '/' . $action;
- if($template_path = $this->_findTemplateByFormat($template_format));
+ if($template_path = $this->_findTemplateByAlias($template_format));
{
$this->map_changed = true;
$this->action_template_map[$this->name][$action] = $template_path;
@@ -158,11 +158,11 @@
$this->action_template_map[$this->name][$action] = false;
}
- protected function _findTemplateByFormat($template_format)
+ protected function _findTemplateByAlias($template_format)
{
foreach($this->toolkit->getSupportedViewExtensions() as $ext)
{
- if($template_path = $this->toolkit->locateTemplateByAlias(sprintf($template_format, $ext)))
+ if($template_path = $this->toolkit->locateTemplateByAlias($template_format . $ext))
{
return $template_path;
}
Modified: 3.x/trunk/limb/web_app/tests/cases/plain/controller/lmbControllerTest.class.php
===================================================================
--- 3.x/trunk/limb/web_app/tests/cases/plain/controller/lmbControllerTest.class.php 2007-11-07 20:55:51 UTC (rev 6501)
+++ 3.x/trunk/limb/web_app/tests/cases/plain/controller/lmbControllerTest.class.php 2007-11-08 07:33:43 UTC (rev 6502)
@@ -117,7 +117,18 @@
$controller->performAction();
$this->assertTrue($this->toolkit->getView()->getTemplate(), 'testing/detail.html');
}
+
+ function testGuessingTemplateWorksOkForActionWithPercentageSymbol()
+ {
+ $this->toolkit->setSupportedViewTypes(array('.html' => 'lmbDummyView'));
+ $controller = new TestingController();
+ $controller->setCurrentAction('detail%28');
+
+ $controller->performAction();
+ $this->assertTrue($this->toolkit->getView()->getTemplate(), 'testing/detail%28.html');
+ }
+
function testControllerAttributesAutomaticallyPassedToView()
{
$this->toolkit->setSupportedViewTypes(array('.html' => 'lmbDummyView'));
@@ -144,17 +155,6 @@
$this->assertTrue($controller->actionExists('detail'));
}
- function setTemplateIfItExistsBeforePerformingAction()
- {
- $this->toolkit->setSupportedViewTypes(array('.html' => 'lmbDummyView'));
-
- $controller = new TestingController();
- $controller->setCurrentAction('detail');
-
- $controller->performAction();
- $this->assertTrue($controller->template_name, 'testing/detail.html');
- }
-
function testValidateOk()
{
$controller = new TestingController();
More information about the limb-svn
mailing list