function testTrickyComment() { $comment = "my dummy */ comment\non more than one\nline"; $this->newComment($comment); $this->_att->before($this->_gen); $this->_att->after($this->_gen); $res = $this->_gen->getResult(); $comment = str_replace('*/', '* /', $comment); $this->assertEquals(normalize_phpsource("<?php /* {$comment} */; ?>"), normalize_phpsource($res)); }
function testFunctionsGeneration() { $state = new PHPTAL_Php_State($this->newPHPTAL()); $codewriter = new PHPTAL_Php_CodeWriter($state); $codewriter->doFunction('test1', '$tpl'); $codewriter->pushHTML($codewriter->interpolateHTML('test1')); $codewriter->doFunction('test2', '$tpl'); $codewriter->pushHTML('test2'); $codewriter->doEnd(); $codewriter->pushHTML('test1'); $codewriter->doEnd(); $res = $codewriter->getResult(); $exp = <<<EOS <?php function test2(\$tpl) {?>test2<?php}?> <?php function test1(\$tpl) {?>test1test1<?php}?> EOS; $res = normalize_phpsource($res, true); $exp = normalize_phpsource($exp, true); $this->assertEquals($exp, $res); }