* @author Kornel LesiƄski * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @version SVN: $Id: CommentTest.php 888 2010-06-08 09:48:33Z kornel $ * @link http://phptal.org/ */ class CommentTest extends PHPTAL_TestCase { function testSimple() { $source = ''; $tpl = $this->newPHPTAL(); $tpl->setSource($source); $res = $tpl->execute(); $this->assertEquals($source, $res); } function testNoEntities() { $source = ''; $tpl = $this->newPHPTAL(); $tpl->setSource($source, __FILE__); $res = $tpl->execute(); $this->assertEquals($source, $res); } function testShortComments() { $source = '<-->'; $tpl = $this->newPHPTAL(); $tpl->setSource($source); $res = $tpl->execute(); $this->assertEquals($source, $res); } /** * @expectedException PHPTAL_ParserException */ function testNestedComments() { $source = ''; $tpl = $this->newPHPTAL(); $tpl->setSource($source); $res = $tpl->execute(); $this->fail("Ill-formed comment accepted"); } /** * @expectedException PHPTAL_ParserException */ function testDashedComment() { $source = ''; $tpl = $this->newPHPTAL(); $tpl->setSource($source); $res = $tpl->execute(); $this->fail("Ill-formed comment accepted"); } function testSkippedComments() { $source = ''; $tpl = $this->newPHPTAL(); $tpl->setSource($source); $res = $tpl->execute(); $this->assertEquals('', $res); } function testCStyleComments() { $tpl = $this->newPHPTAL(); $src = ''; $tpl->setSource($src); $this->assertEquals($src, $tpl->execute()); } }