Add a failing test for #128
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2013 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group lambdas
|
||||
* @group functional
|
||||
*/
|
||||
class Mustache_Test_Functional_PartialLambdaIndentTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testLambdasInsidePartialsAreIndentedProperly()
|
||||
{
|
||||
$src = <<<EOS
|
||||
<fieldset>
|
||||
{{> input }}
|
||||
</fieldset>
|
||||
|
||||
EOS;
|
||||
$partial = <<<EOS
|
||||
<input placeholder="{{# _t }}Enter your name{{/ _t }}">
|
||||
|
||||
EOS;
|
||||
|
||||
$expected = <<<EOS
|
||||
<fieldset>
|
||||
<input placeholder="ENTER YOUR NAME">
|
||||
</fieldset>
|
||||
|
||||
EOS;
|
||||
|
||||
$m = new Mustache_Engine(array(
|
||||
'partials' => array('input' => $partial)
|
||||
));
|
||||
|
||||
$tpl = $m->loadTemplate($src);
|
||||
|
||||
|
||||
$data = new Mustache_Test_Functional_ClassWithLambda();
|
||||
$this->assertEquals($expected, $tpl->render($data));
|
||||
}
|
||||
}
|
||||
|
||||
class Mustache_Test_Functional_ClassWithLambda
|
||||
{
|
||||
public function _t()
|
||||
{
|
||||
return function($val) {
|
||||
return strtoupper($val);
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user