|
@@ -104,7 +104,7 @@ class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase
|
|
|
$mustache->setLoader($loader);
|
|
$mustache->setLoader($loader);
|
|
|
$this->assertSame($loader, $mustache->getLoader());
|
|
$this->assertSame($loader, $mustache->getLoader());
|
|
|
|
|
|
|
|
- $this->assertSame($loader, $mustache->getPartialsLoader());
|
|
|
|
|
|
|
+ $this->assertNotSame($loader, $mustache->getPartialsLoader());
|
|
|
$mustache->setPartialsLoader($loader);
|
|
$mustache->setPartialsLoader($loader);
|
|
|
$this->assertSame($loader, $mustache->getPartialsLoader());
|
|
$this->assertSame($loader, $mustache->getPartialsLoader());
|
|
|
|
|
|
|
@@ -240,6 +240,29 @@ class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase
|
|
|
$mustache->setLogger(new StdClass);
|
|
$mustache->setLogger(new StdClass);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function testLoadPartialCascading()
|
|
|
|
|
+ {
|
|
|
|
|
+ $loader = new Mustache_Loader_ArrayLoader(array(
|
|
|
|
|
+ 'foo' => 'FOO',
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+ $mustache = new Mustache_Engine(array('loader' => $loader));
|
|
|
|
|
+
|
|
|
|
|
+ $tpl = $mustache->loadTemplate('foo');
|
|
|
|
|
+
|
|
|
|
|
+ $this->assertSame($tpl, $mustache->loadPartial('foo'));
|
|
|
|
|
+
|
|
|
|
|
+ $mustache->setPartials(array(
|
|
|
|
|
+ 'foo' => 'f00',
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+ // setting partials overrides the default template loading fallback.
|
|
|
|
|
+ $this->assertNotSame($tpl, $mustache->loadPartial('foo'));
|
|
|
|
|
+
|
|
|
|
|
+ // but it didn't overwrite the original template loader templates.
|
|
|
|
|
+ $this->assertSame($tpl, $mustache->loadTemplate('foo'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function testPartialLoadFailLogging()
|
|
public function testPartialLoadFailLogging()
|
|
|
{
|
|
{
|
|
|
$name = tempnam(sys_get_temp_dir(), 'mustache-test');
|
|
$name = tempnam(sys_get_temp_dir(), 'mustache-test');
|