* @author Kornel LesiƄski * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @version SVN: $Id: CommentTest.php 750 2009-10-24 22:03:17Z kornel $ * @link http://phptal.org/ */ require_once dirname(__FILE__)."/config.php"; 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()); } }