This commit is contained in:
Uwe Tews
2015-05-04 04:03:09 +02:00
parent 26146a67a6
commit 69b2f86d91
2 changed files with 42 additions and 2 deletions

View File

@@ -4,10 +4,10 @@
For installing the PHPUnit test by composer use the following:
"require-dev": {
"smarty/smarty-phpunit": "3.1.18"
"smarty/smarty-phpunit": "3.1.20"
}
Replace 3.1.19 with the installed Smarty version number.
Replace 3.1.20 with the installed Smarty version number.
Starting with Smarty version 3.1.22 the "require-dev" section will be added
to the composer.json file of the Smarty distribution.

View File

@@ -51,6 +51,16 @@ public function testPHP_REMOVEphp()
$this->assertEquals("a echo 'hello world';e", $content, 'remove <% %>');
}
/**
* test <script language='php'>...</script> tag
* PHP_REMOVE
*/
public function testPHP_REMOVEscript()
{
$this->smarty->setPhpHandling(Smarty::PHP_REMOVE);
$content = $this->smarty->fetch("string:a<script language='php'> echo 'hello world';</script>e");
$this->assertEquals("a echo 'hello world';e", $content, "remove <script language='php'>");
}
/**
* test <?php...\> tag
@@ -75,6 +85,16 @@ public function testPHP_REMOVEphp()
$content = $this->smarty->fetch("string:pa<% echo 'hello world';%>pe");
$this->assertEquals("pa<% echo 'hello world';%>pe", $content, 'passthru <% %>');
}
/**
* test <script language='php'>...</script> tag
* PHP_PASSTHRU
*/
public function testPHP_PASSTHRUscript()
{
$this->smarty->setPhpHandling(Smarty::PHP_PASSTHRU);
$content = $this->smarty->fetch("string:pa<script language='php'> echo 'hello world';</script>pe");
$this->assertEquals("pa<script language=\'php\'> echo 'hello world';</script>pe", $content, "passthru <script language='php'>");
}
/**
* test <?php...\> tag
* PHP_QUOTE
@@ -98,6 +118,16 @@ public function testPHP_REMOVEphp()
$content = $this->smarty->fetch("string:qa<% echo 'hello world';%>qe");
$this->assertEquals("qa&lt;% echo 'hello world';%&gt;qe", $content, 'qoute <% %>');
}
/**
* test <script language='php'>...</script> tag
* PHP_QUOTE
*/
public function testPHP_QUOTEscript()
{
$this->smarty->setPhpHandling(Smarty::PHP_QUOTE);
$content = $this->smarty->fetch("string:qa<script language='php'> echo 'hello world';</script>qe");
$this->assertEquals("qa&lt;script language=&#039;php&#039;&gt; echo 'hello world';&lt;/script&gt;qe", $content, "quote <script language='php'>");
}
/**
* test <?php...\> tag
* PHP_ALLOW
@@ -120,6 +150,16 @@ public function testPHP_REMOVEphp()
$content = $this->smartyBC->fetch("string:aa <% echo 'hello world';%> ae");
$this->assertEquals('aa hello world ae', $content, 'allow <% %>');
}
/**
* test <script language='php'>...</script> tag
* PHP_ALLOW
*/
public function testPHP_ALLOWscript()
{
$this->smartyBC->setPhpHandling(Smarty::PHP_ALLOW);
$content = $this->smartyBC->fetch("string:aa <script language='php'> echo 'hello world';</script> ae");
$this->assertEquals('aa hello world ae', $content, "allow <script language='php'>");
}
/**
* test <?php...\> tag
* PHP_ALLOW