Commit 3a66a7cd by Seldaek

* Fixes two class path glitches

git-svn-id: svn://dwoo.org/dwoo/trunk@11 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent fca0a519
...@@ -18,7 +18,7 @@ if(is_writable(DWOO_COMPILE_DIRECTORY) === false) ...@@ -18,7 +18,7 @@ if(is_writable(DWOO_COMPILE_DIRECTORY) === false)
// include class paths or rebuild paths if the cache file isn't there // include class paths or rebuild paths if the cache file isn't there
if((file_exists(DWOO_COMPILE_DIRECTORY.DIRECTORY_SEPARATOR.'classpath.cache.php') && include DWOO_COMPILE_DIRECTORY.DIRECTORY_SEPARATOR.'classpath.cache.php') === false) if((file_exists(DWOO_COMPILE_DIRECTORY.DIRECTORY_SEPARATOR.'classpath.cache.php') && include DWOO_COMPILE_DIRECTORY.DIRECTORY_SEPARATOR.'classpath.cache.php') === false)
DwooLoader::rebuildClassPathCache(DWOO_DIRECTORY.'plugins', DWOO_COMPILE_DIRECTORY.DIRECTORY_SEPARATOR.'classpath.cache'); DwooLoader::rebuildClassPathCache(DWOO_DIRECTORY.'plugins', DWOO_COMPILE_DIRECTORY.DIRECTORY_SEPARATOR.'classpath.cache.php');
DwooLoader::loadPlugin('topLevelBlock'); DwooLoader::loadPlugin('topLevelBlock');
...@@ -1501,7 +1501,7 @@ class DwooLoader ...@@ -1501,7 +1501,7 @@ class DwooLoader
*/ */
public static function addDirectory($pluginDir) public static function addDirectory($pluginDir)
{ {
$cacheFile = DWOO_COMPILE_DIRECTORY . DIRECTORY_SEPARATOR . 'classpath-'.substr(strtr($pluginDir, ':/\\.', '----'), -80).'.cache.php'; $cacheFile = DWOO_COMPILE_DIRECTORY . DIRECTORY_SEPARATOR . 'classpath-'.substr(strtr($pluginDir, ':/\\.', '----'), strlen($pluginDir) > 80 ? -80 : 0).'.cache.php';
self::$paths[] = array($pluginDir, $cacheFile); self::$paths[] = array($pluginDir, $cacheFile);
if(file_exists($cacheFile)) if(file_exists($cacheFile))
include $cacheFile; include $cacheFile;
......
...@@ -138,10 +138,10 @@ class CompilerTests extends PHPUnit_Framework_TestCase ...@@ -138,10 +138,10 @@ class CompilerTests extends PHPUnit_Framework_TestCase
public function testExpressions() public function testExpressions()
{ {
$tpl = new DwooTemplateString('{$foo+5} {$foo+$foo} {$foo+3*$foo} {$foo*$foo+4*$foo} {$foo*2/2|number_format} {$foo*2/3|number_format:1} {number_format $foo*2/3 1}'); $tpl = new DwooTemplateString('{$foo+5} {$foo+$foo} {$foo+3*$foo} {$foo*$foo+4*$foo} {$foo*2/2|number_format} {$foo*2/3|number_format:1} {number_format $foo*2/3 1} {if $foo+5>9 && $foo < 7 && $foo+$foo==$foo*2}win{/if} {$arr[$foo+3]}');
$tpl->forceCompilation(); $tpl->forceCompilation();
$this->assertEquals("10 10 40 145 5 3.3 3.3", $this->dwoo->get($tpl, array('foo'=>5), $this->compiler)); $this->assertEquals("10 10 40 145 5 3.3 3.3 win win", $this->dwoo->get($tpl, array('foo'=>5, 'arr'=>array(8=>'win')), $this->compiler));
$tpl = new DwooTemplateString('{"$foo/$foo"}'); $tpl = new DwooTemplateString('{"$foo/$foo"}');
$tpl->forceCompilation(); $tpl->forceCompilation();
......
<?php <?php
define('DWOO_CACHEDIR', dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR.'cache'); define('DWOO_CACHE_DIRECTORY', dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR.'cache');
define('DWOO_COMPILEDIR', dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR.'compiled'); define('DWOO_COMPILE_DIRECTORY', dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR.'compiled');
require dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Dwoo.php'; require dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Dwoo.php';
class DwooTests { class DwooTests {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment