Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 70dda9f

Browse files
committed
3.1.20
1 parent 4ac575c commit 70dda9f

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
For installing the PHPUnit test by composer use the following:
55

66
"require-dev": {
7-
"smarty/smarty-phpunit": "3.1.18"
7+
"smarty/smarty-phpunit": "3.1.20"
88
}
99

10-
Replace 3.1.19 with the installed Smarty version number.
10+
Replace 3.1.20 with the installed Smarty version number.
1111

1212
Starting with Smarty version 3.1.22 the "require-dev" section will be added
1313
to the composer.json file of the Smarty distribution.

UnitTests/TemplateSource/TagTests/Php/CompilePhpTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ public function testPHP_REMOVEasp()
5151
$this->assertEquals("a echo 'hello world';e", $content, 'remove <% %>');
5252

5353

54+
}
55+
/**
56+
* test <script language='php'>...</script> tag
57+
* PHP_REMOVE
58+
*/
59+
public function testPHP_REMOVEscript()
60+
{
61+
$this->smarty->setPhpHandling(Smarty::PHP_REMOVE);
62+
$content = $this->smarty->fetch("string:a<script language='php'> echo 'hello world';</script>e");
63+
$this->assertEquals("a echo 'hello world';e", $content, "remove <script language='php'>");
5464
}
5565
/**
5666
* test <?php...\> tag
@@ -75,6 +85,16 @@ public function testPHP_PASSTHRUasp()
7585
$content = $this->smarty->fetch("string:pa<% echo 'hello world';%>pe");
7686
$this->assertEquals("pa<% echo 'hello world';%>pe", $content, 'passthru <% %>');
7787
}
88+
/**
89+
* test <script language='php'>...</script> tag
90+
* PHP_PASSTHRU
91+
*/
92+
public function testPHP_PASSTHRUscript()
93+
{
94+
$this->smarty->setPhpHandling(Smarty::PHP_PASSTHRU);
95+
$content = $this->smarty->fetch("string:pa<script language='php'> echo 'hello world';</script>pe");
96+
$this->assertEquals("pa<script language=\'php\'> echo 'hello world';</script>pe", $content, "passthru <script language='php'>");
97+
}
7898
/**
7999
* test <?php...\> tag
80100
* PHP_QUOTE
@@ -98,6 +118,16 @@ public function testPHP_QUOTEasp()
98118
$content = $this->smarty->fetch("string:qa<% echo 'hello world';%>qe");
99119
$this->assertEquals("qa&lt;% echo 'hello world';%&gt;qe", $content, 'qoute <% %>');
100120
}
121+
/**
122+
* test <script language='php'>...</script> tag
123+
* PHP_QUOTE
124+
*/
125+
public function testPHP_QUOTEscript()
126+
{
127+
$this->smarty->setPhpHandling(Smarty::PHP_QUOTE);
128+
$content = $this->smarty->fetch("string:qa<script language='php'> echo 'hello world';</script>qe");
129+
$this->assertEquals("qa&lt;script language=&#039;php&#039;&gt; echo 'hello world';&lt;/script&gt;qe", $content, "quote <script language='php'>");
130+
}
101131
/**
102132
* test <?php...\> tag
103133
* PHP_ALLOW
@@ -120,6 +150,16 @@ public function testPHP_ALLOWasp()
120150
$content = $this->smartyBC->fetch("string:aa <% echo 'hello world';%> ae");
121151
$this->assertEquals('aa hello world ae', $content, 'allow <% %>');
122152
}
153+
/**
154+
* test <script language='php'>...</script> tag
155+
* PHP_ALLOW
156+
*/
157+
public function testPHP_ALLOWscript()
158+
{
159+
$this->smartyBC->setPhpHandling(Smarty::PHP_ALLOW);
160+
$content = $this->smartyBC->fetch("string:aa <script language='php'> echo 'hello world';</script> ae");
161+
$this->assertEquals('aa hello world ae', $content, "allow <script language='php'>");
162+
}
123163
/**
124164
* test <?php...\> tag
125165
* PHP_ALLOW

0 commit comments

Comments
 (0)