Example #1
0
   function testCompileContent()
   {
       $compil = new testJtplContentCompiler();
       $compil->outputType = 'html';
       $compil->trusted = true;
       $compil->setUserPlugins(array(), array('bla' => 'testjtplcontentUserFunction'));
       $compil->setEscapePI(false);
       $compil->setRemoveASPtags(false);
       foreach ($this->content as $k => $t) {
           try {
               $this->assertEqualOrDiff($t[1], $compil->compileContent2($t[0]));
           } catch (Exception $e) {
               $this->fail("Test '{$k}', Unknown Exception: " . $e->getMessage());
           }
       }
       $compil->setEscapePI(true);
       $compil->setRemoveASPtags(false);
       $this->assertEqualOrDiff('<p>ok<?php echo \'<?xml version="truc"?>\'?></p>', $compil->compileContent2('<p>ok<?xml version="truc"?></p>'));
       $this->assertEqualOrDiff('<p>ok<?php echo \'<?xml version=\\\'truc\\\'?>\'?></p>', $compil->compileContent2('<p>ok<?xml version=\'truc\'?></p>'));
       $this->assertEqualOrDiff('<p>ok<?php echo \'<?xml
 version="truc"?>\'?></p>', $compil->compileContent2('<p>ok<?xml
 version="truc"?></p>'));
       $this->assertEqualOrDiff('<p>ok<%=$truc%></p>', $compil->compileContent2('<p>ok<%=$truc%></p>'));
       $compil->setRemoveASPtags(true);
       $this->assertEqualOrDiff('<p>ok</p>', $compil->compileContent2('<p>ok<%=$truc%></p>'));
   }