diff --git a/tests/UnitTests/Compiler/Delimiter/AutoLiteralTest.php b/tests/UnitTests/Compiler/Delimiter/AutoLiteralTest.php index fd65c53a..32dde734 100644 --- a/tests/UnitTests/Compiler/Delimiter/AutoLiteralTest.php +++ b/tests/UnitTests/Compiler/Delimiter/AutoLiteralTest.php @@ -9,7 +9,6 @@ /** * class for delimiter tests * - * @runTestsInSeparateProcess * @preserveGlobalState disabled * @backupStaticAttributes enabled */ @@ -40,8 +39,40 @@ class AutoliteralTest extends PHPUnit_Smarty { $this->smarty->setAutoLiteral(false); $this->smarty->setCompileId(1); - $this->smarty->assign('i','foo'); - $this->assertEquals('foofoo', $this->smarty->fetch('autoliteral.tpl')); + $this->smarty->assign('i','bar'); + $this->assertEquals('barbar', $this->smarty->fetch('autoliteral.tpl')); + } + /** + * test '{ ' delimiter in double quotes auto_literal true + * @runInSeparateProcess + * + */ + public function testSetAutoliteralDoublequote() + { + $this->smarty->setAutoLiteral(true); + $this->assertEquals(' output: double { counter} 1 quote', $this->smarty->fetch('autoliteraldoublequote.tpl')); + } + /** + * test '{ ' delimiter in double quotes auto_literal false + * @runInSeparateProcess + * + */ + public function testSetAutoliteralDoublequote2() + { + $this->smarty->setAutoLiteral(false); + $this->smarty->setCompileId(1); + $this->assertEquals(' output: double 1 2 quote', $this->smarty->fetch('autoliteraldoublequote.tpl')); + } + + /** + * test '{{ ' delimiter in double quotes auto_literal true + * @runInSeparateProcess + * + */ + public function testSetAutoliteralDoublequote3() + { + $this->smarty->setAutoLiteral(true); + $this->assertEquals(' output: double {{ counter} {{ counter}} quote', $this->smarty->fetch('autoliteraldoublequote2.tpl')); } public function testSetAutoliteralBlock() diff --git a/tests/UnitTests/Compiler/Delimiter/DelimiterTest.php b/tests/UnitTests/Compiler/Delimiter/DelimiterTest.php index a469c270..3bddff1b 100644 --- a/tests/UnitTests/Compiler/Delimiter/DelimiterTest.php +++ b/tests/UnitTests/Compiler/Delimiter/DelimiterTest.php @@ -32,8 +32,8 @@ class DelimiterTest extends PHPUnit_Smarty { $this->smarty->left_delimiter = '<{'; $this->smarty->right_delimiter = '}>'; - $tpl = $this->smarty->createTemplate('eval:<{* comment *}><{if true}><{"hello world"}><{/if}>'); - $this->assertEquals("hello world", $this->smarty->fetch($tpl)); + $tpl = $this->smarty->createTemplate('eval:start <{* comment *}>hello <{if true}><{"world"}><{/if}> end'); + $this->assertEquals("start hello world end", $this->smarty->fetch($tpl)); } /** * test <{ }> delimiter @@ -42,8 +42,8 @@ class DelimiterTest extends PHPUnit_Smarty { $this->smarty->left_delimiter = '<'; $this->smarty->right_delimiter = '>'; - $tpl = $this->smarty->createTemplate('eval:<* comment *><"hello world">'); - $this->assertEquals("hello world", $this->smarty->fetch($tpl)); + $tpl = $this->smarty->createTemplate('eval:start <* comment *>hello <"world"> end'); + $this->assertEquals("start hello world end", $this->smarty->fetch($tpl)); } /** @@ -53,8 +53,8 @@ class DelimiterTest extends PHPUnit_Smarty { $this->smarty->left_delimiter = '<-{'; $this->smarty->right_delimiter = '}->'; - $tpl = $this->smarty->createTemplate('eval:<-{* comment *}-><-{if true}-><-{"hello world"}-><-{/if}->'); - $this->assertEquals("hello world", $this->smarty->fetch($tpl)); + $tpl = $this->smarty->createTemplate('eval:<-<-{* comment *}-><-{if true}-><-{"hello world"}-><-{/if}->->'); + $this->assertEquals("<-hello world->", $this->smarty->fetch($tpl)); } /** diff --git a/tests/UnitTests/Compiler/Delimiter/UserLiteralTest.php b/tests/UnitTests/Compiler/Delimiter/UserLiteralTest.php index 0e0b35cd..49f8d79c 100644 --- a/tests/UnitTests/Compiler/Delimiter/UserLiteralTest.php +++ b/tests/UnitTests/Compiler/Delimiter/UserLiteralTest.php @@ -63,4 +63,10 @@ class UserliteralTest extends PHPUnit_Smarty $this->smarty->setLiterals(array('<--','-->')); $this->assertEquals('<- 1 -> <--1-->', $this->smarty->fetch('userliteral2.tpl')); } + public function testUserLiteral5() + { + $this->smarty->setAutoLiteral(true); + $this->smarty->setLiterals(array('{%')); + $this->assertEquals(' output: double {%counter} quote', $this->smarty->fetch('userliteraldoublequote.tpl')); + } } diff --git a/tests/UnitTests/Compiler/Delimiter/templates/autoliteraldoublequote.tpl b/tests/UnitTests/Compiler/Delimiter/templates/autoliteraldoublequote.tpl new file mode 100644 index 00000000..23913dd3 --- /dev/null +++ b/tests/UnitTests/Compiler/Delimiter/templates/autoliteraldoublequote.tpl @@ -0,0 +1 @@ +{$foo="double { counter} {counter} quote"} output: {$foo} \ No newline at end of file diff --git a/tests/UnitTests/Compiler/Delimiter/templates/autoliteraldoublequote2.tpl b/tests/UnitTests/Compiler/Delimiter/templates/autoliteraldoublequote2.tpl new file mode 100644 index 00000000..d9dab090 --- /dev/null +++ b/tests/UnitTests/Compiler/Delimiter/templates/autoliteraldoublequote2.tpl @@ -0,0 +1 @@ +{$foo="double {{ counter} {{ counter}} quote"} output: {$foo} \ No newline at end of file diff --git a/tests/UnitTests/Compiler/Delimiter/templates/userliteraldoublequote.tpl b/tests/UnitTests/Compiler/Delimiter/templates/userliteraldoublequote.tpl new file mode 100644 index 00000000..5e654c06 --- /dev/null +++ b/tests/UnitTests/Compiler/Delimiter/templates/userliteraldoublequote.tpl @@ -0,0 +1 @@ +{$foo="double {%counter} quote"} output: {$foo} \ No newline at end of file