fenom/tests/cases/Fenom/CommentTest.php

35 lines
892 B
PHP
Raw Normal View History

2013-05-30 22:41:58 +04:00
<?php
2013-06-28 11:53:53 +04:00
namespace Fenom;
2013-05-30 22:41:58 +04:00
2013-07-29 14:58:14 +04:00
class CommentTest extends TestCase
{
2013-05-30 22:41:58 +04:00
/**
* @dataProvider providerScalars
*/
2013-07-29 14:58:14 +04:00
public function testInline($tpl_val)
{
2013-05-30 22:41:58 +04:00
$this->assertRender("before {* $tpl_val *} after", "before after");
$this->assertRender("before {* {{$tpl_val}} {{$tpl_val}} *} after", "before after");
$this->assertRender("before {*{{$tpl_val}}*} after", "before after");
}
2013-07-29 14:58:14 +04:00
public function testError()
{
$this->execError('{* ', 'Fenom\CompileException', "Unclosed comment block in line");
}
2013-07-29 14:58:14 +04:00
/**
* @dataProvider providerScalars
*/
public function testMultiLine($tpl_val)
{
$this->assertRender(
"before-1\nbefore-2 {* before-3\nbefore-4 $tpl_val after-1\nafter-2 *} after-3\nafter-4{* dummy *}\nafter-5",
"before-1\nbefore-2 after-3\nafter-4\nafter-5"
);
2013-05-30 22:41:58 +04:00
}
}