add test for InlineLoader

This commit is contained in:
Hiroyuki Toda 2015-01-26 21:37:51 +09:00
parent 4bf343d122
commit 317e1ebd6c

View File

@ -619,6 +619,23 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('test', $engine->render('loader', array())); $this->assertEquals('test', $engine->render('loader', array()));
} }
/**
* Test inline loader
*/
public function testInlineLoader()
{
$loader = new \Handlebars\Loader\InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
$this->assertEquals('This is a inline template.', $loader->load('template1'));
$expected = <<<EOM
a
b
c
d
EOM;
$this->assertEquals($expected, $loader->load('template2'));
}
/** /**
* Test file system loader * Test file system loader
*/ */
@ -1156,3 +1173,17 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($argsString, (string)$args); $this->assertEquals($argsString, (string)$args);
} }
} }
/**
* Testcase for testInlineLoader
*
*/
__halt_compiler();
@@ template1
This is a inline template.
@@ template2
a
b
c
d