Add tests for missed Mustache helpers

This is the missed test case for #121
This commit is contained in:
Dmitriy Simushev 2015-06-23 20:57:29 +00:00
parent f3067cb41a
commit 2c78af65e0

View File

@ -471,6 +471,7 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
$engine = new \Handlebars\Handlebars(array('loader' => $loader)); $engine = new \Handlebars\Handlebars(array('loader' => $loader));
$this->assertEquals('yes', $engine->render('{{#x}}yes{{/x}}', array('x' => true))); $this->assertEquals('yes', $engine->render('{{#x}}yes{{/x}}', array('x' => true)));
$this->assertEquals('', $engine->render('{{#x}}yes{{/x}}', array('x' => false))); $this->assertEquals('', $engine->render('{{#x}}yes{{/x}}', array('x' => false)));
$this->assertEquals('', $engine->render('{{#NOTVALID}}XXX{{/NOTVALID}}', array()));
$this->assertEquals('yes', $engine->render('{{^x}}yes{{/x}}', array('x' => false))); $this->assertEquals('yes', $engine->render('{{^x}}yes{{/x}}', array('x' => false)));
$this->assertEquals('', $engine->render('{{^x}}yes{{/x}}', array('x' => true))); $this->assertEquals('', $engine->render('{{^x}}yes{{/x}}', array('x' => true)));
$this->assertEquals('1234', $engine->render('{{#x}}{{this}}{{/x}}', array('x' => array(1, 2, 3, 4)))); $this->assertEquals('1234', $engine->render('{{#x}}{{this}}{{/x}}', array('x' => array(1, 2, 3, 4))));