diff --git a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php
index 5883e98..43e927e 100644
--- a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php
+++ b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php
@@ -13,9 +13,8 @@
* @group lambdas
* @group functional
*/
-class Mustache_Test_Functional_HigherOrderSectionsTest extends PHPUnit_Framework_TestCase
+class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_FunctionalTestCase
{
-
private $mustache;
public function setUp()
@@ -100,6 +99,49 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends PHPUnit_Framework
$this->assertEquals('' . $foo->name . '', $tpl->render($foo));
}
+
+ public function testEnablingLambdaCacheActuallyWorks()
+ {
+ $cacheDir = $this->setUpCacheDir('test_enabling_lambda_cache');
+ $mustache = new Mustache_Engine(array(
+ 'template_class_prefix' => '_TestEnablingLambdaCache_',
+ 'cache' => $cacheDir,
+ 'cache_lambda_templates' => true,
+ ));
+
+ $tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
+ $foo = new Mustache_Test_Functional_Foo;
+ $foo->wrap = array($foo, 'wrapWithEm');
+ $this->assertEquals('' . $foo->name . '', $tpl->render($foo));
+ $this->assertCount(2, glob($cacheDir . '/*.php'));
+ }
+
+ public function testDisablingLambdaCacheActuallyWorks()
+ {
+ $cacheDir = $this->setUpCacheDir('test_disabling_lambda_cache');
+ $mustache = new Mustache_Engine(array(
+ 'template_class_prefix' => '_TestDisablingLambdaCache_',
+ 'cache' => $cacheDir,
+ 'cache_lambda_templates' => false,
+ ));
+
+ $tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
+ $foo = new Mustache_Test_Functional_Foo;
+ $foo->wrap = array($foo, 'wrapWithEm');
+ $this->assertEquals('' . $foo->name . '', $tpl->render($foo));
+ $this->assertCount(1, glob($cacheDir . '/*.php'));
+ }
+
+ protected function setUpCacheDir($name)
+ {
+ $cacheDir = self::$tempDir . '/' . $name;
+ if (file_exists($cacheDir)) {
+ self::rmdir($cacheDir);
+ }
+ mkdir($cacheDir, 0777, true);
+
+ return $cacheDir;
+ }
}
class Mustache_Test_Functional_Foo
diff --git a/test/Mustache/Test/FunctionalTestCase.php b/test/Mustache/Test/FunctionalTestCase.php
index 73cfa9c..4d243e0 100644
--- a/test/Mustache/Test/FunctionalTestCase.php
+++ b/test/Mustache/Test/FunctionalTestCase.php
@@ -24,7 +24,7 @@ abstract class Mustache_Test_FunctionalTestCase extends PHPUnit_Framework_TestCa
/**
* @param string $path
*/
- private static function rmdir($path)
+ protected static function rmdir($path)
{
$path = rtrim($path, '/').'/';
$handle = opendir($path);