[limb-svn] r6771 - in 3.x/trunk/limb/macro: src tests/cases/compiler

svn at limb-project.com svn at limb-project.com
Thu Feb 7 14:10:11 MSK 2008


Author: korchasa
Date: 2008-02-07 14:10:11 +0300 (Thu, 07 Feb 2008)
New Revision: 6771
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6771

Modified:
   3.x/trunk/limb/macro/src/lmbMacroTemplateLocatorSimple.class.php
   3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateLocatorSimpleTest.class.php
Log:
 -- remove throwing of exception when compiled template not found

Modified: 3.x/trunk/limb/macro/src/lmbMacroTemplateLocatorSimple.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTemplateLocatorSimple.class.php	2008-02-07 10:56:55 UTC (rev 6770)
+++ 3.x/trunk/limb/macro/src/lmbMacroTemplateLocatorSimple.class.php	2008-02-07 11:10:11 UTC (rev 6771)
@@ -24,8 +24,6 @@
 
   function locateSourceTemplate($file_name)
   {                
-//    if(file_exists($file_name))
-//      return $file_name;
     $file_path = $this->config['tpl_scan_dirs'].'/'.$file_name;
     if(!file_exists($file_path))
       throw new lmbMacroException('template file not found', array('template' => $file_path));
@@ -34,10 +32,7 @@
 
   function locateCompiledTemplate($file_name)
   {
-    $file_path = $this->config['cache_dir'] . '/' . md5($file_name) . '.php';
-    if(!file_exists($file_path))
-      throw new lmbMacroException('compiled template file not found', array('compiled template' => $file_path));
-    return $file_path;
+    return $this->config['cache_dir'] . '/' . md5($file_name) . '.php';
   }
 }
 

Modified: 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateLocatorSimpleTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateLocatorSimpleTest.class.php	2008-02-07 10:56:55 UTC (rev 6770)
+++ 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateLocatorSimpleTest.class.php	2008-02-07 11:10:11 UTC (rev 6771)
@@ -26,7 +26,7 @@
       $this->pass();
     }
     
-    $this->_createMacroTemplate('bar',$this->template_name);
+    $this->_createMacroTemplate('bar',$this->template_name); 
     
     try
     {
@@ -43,35 +43,15 @@
   
   function testLocateCompiledTemplate()
   {
-    
-    $config = $this->_createMacroConfig();
-         
-    $template_locator = new lmbMacroTemplateLocatorSimple($config);
-    try
-    {
-      $template = $template_locator->locateCompiledTemplate($this->template_name);
-      $this->fail();
-    } 
-    catch (lmbMacroException $e) 
-    {      
-      $this->pass();
-    }
-    
+    $template_locator = new lmbMacroTemplateLocatorSimple($config = $this->_createMacroConfig());    
     $compiled_file_name = md5($this->template_name);
     file_put_contents($config['cache_dir'].'/'.$compiled_file_name . '.php', 'bar');
     
-    try
-    {
-      $template = $template_locator->locateCompiledTemplate($this->template_name);
-      $this->pass();
-    } 
-    catch (lmbMacroException $e) 
-    {      
-      $this->fail();
-    }
+    $template = $template_locator->locateCompiledTemplate($this->template_name);
     
     $this->assertEqual('bar', file_get_contents($template));
   }
+  
 }
 
 



More information about the limb-svn mailing list