-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
95 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{if $n < 10} | ||
{include 'bug241/recursive.tpl' n=$n - 1} | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,48 +268,6 @@ public static function providerExpressionsInvalid() | |
); | ||
} | ||
|
||
public static function providerInclude() | ||
{ | ||
$a = array( | ||
"name" => "welcome", | ||
"tpl" => "welcome.tpl", | ||
"fragment" => "come", | ||
"pr_fragment" => "Come", | ||
"pr_name" => "Welcome", | ||
"username" => "Master", | ||
"email" => "[email protected]" | ||
); | ||
$result = 'Include <b>Welcome, Master ([email protected])</b> template'; | ||
$result2 = 'Include <b>Welcome, Flame ([email protected])</b> template'; | ||
$result3 = 'Include <b>Welcome, Master ([email protected])</b> template'; | ||
$result4 = 'Include <b>Welcome, Flame ([email protected])</b> template'; | ||
return array( | ||
array('Include {include "welcome.tpl"} template', $a, $result), | ||
array('Include {include "welcome.tpl"} template', $a, $result, Fenom::FORCE_INCLUDE), | ||
array('Include {include $tpl} template', $a, $result), | ||
array('Include {include "$tpl"} template', $a, $result), | ||
array('Include {include "{$tpl}"} template', $a, $result), | ||
array('Include {include "$name.tpl"} template', $a, $result), | ||
array('Include {include "{$name}.tpl"} template', $a, $result), | ||
array('Include {include "{$pr_name|lower}.tpl"} template', $a, $result), | ||
array('Include {include "wel{$fragment}.tpl"} template', $a, $result), | ||
array('Include {include "wel{$pr_fragment|lower}.tpl"} template', $a, $result), | ||
array('Include {include "welcome.tpl" username="Flame"} template', $a, $result2), | ||
array('Include {include "welcome.tpl" username="Flame"} template', $a, $result2, Fenom::FORCE_INCLUDE), | ||
array('Include {include "welcome.tpl" email="[email protected]"} template', $a, $result3), | ||
array( | ||
'Include {include "welcome.tpl" email="[email protected]"} template', | ||
$a, | ||
$result3, | ||
Fenom::FORCE_INCLUDE | ||
), | ||
array( | ||
'Include {include "welcome.tpl" username="Flame" email="[email protected]"} template', | ||
$a, | ||
$result4 | ||
), | ||
); | ||
} | ||
|
||
public static function providerIncludeInvalid() | ||
{ | ||
|
@@ -1195,12 +1153,66 @@ public function testExpressionsInvalid($code, $exception, $message, $options = 0 | |
$this->execError($code, $exception, $message, $options); | ||
} | ||
|
||
|
||
public static function providerInclude() | ||
{ | ||
$a = array( | ||
"name" => "welcome", | ||
"tpl" => "welcome.tpl", | ||
"fragment" => "come", | ||
"pr_fragment" => "Come", | ||
"pr_name" => "Welcome", | ||
"username" => "Master", | ||
"email" => "[email protected]" | ||
); | ||
|
||
$result = 'Include <b>Welcome, Master ([email protected])</b> template'; | ||
$result2 = 'Include <b>Welcome, Flame ([email protected])</b> template'; | ||
$result3 = 'Include <b>Welcome, Master ([email protected])</b> template'; | ||
$result4 = 'Include <b>Welcome, Flame ([email protected])</b> template'; | ||
|
||
$recursive_result = 'Include <b>Hello, Master ([email protected])</b> template'; | ||
$recursive_result2 = 'Include <b>Hello, Flame ([email protected])</b> template'; | ||
return array( | ||
array('Include {include "welcome.tpl"} template', $a, $result), | ||
array('Include {include "welcome.tpl"} template', $a, $result, Fenom::FORCE_INCLUDE), | ||
array('Include {include "recursive.tpl"} template', $a, $recursive_result, Fenom::FORCE_INCLUDE), | ||
array('Include {include $tpl} template', $a, $result), | ||
array('Include {include "$tpl"} template', $a, $result), | ||
array('Include {include "{$tpl}"} template', $a, $result), | ||
array('Include {include "$name.tpl"} template', $a, $result), | ||
array('Include {include "{$name}.tpl"} template', $a, $result), | ||
array('Include {include "{$pr_name|lower}.tpl"} template', $a, $result), | ||
array('Include {include "wel{$fragment}.tpl"} template', $a, $result), | ||
array('Include {include "wel{$pr_fragment|lower}.tpl"} template', $a, $result), | ||
array('Include {include "welcome.tpl" username="Flame"} template', $a, $result2), | ||
array('Include {include "welcome.tpl" username="Flame"} template', $a, $result2, Fenom::FORCE_INCLUDE), | ||
array('Include {include "recursive.tpl" username="Flame"} template', $a, $recursive_result2, Fenom::FORCE_INCLUDE), | ||
array('Include {include "welcome.tpl" email="[email protected]"} template', $a, $result3), | ||
array( | ||
'Include {include "welcome.tpl" email="[email protected]"} template', | ||
$a, | ||
$result3, | ||
Fenom::FORCE_INCLUDE | ||
), | ||
array( | ||
'Include {include "welcome.tpl" username="Flame" email="[email protected]"} template', | ||
$a, | ||
$result4, | ||
), | ||
); | ||
} | ||
|
||
/** | ||
* @group include | ||
* @group dev | ||
* @dataProvider providerInclude | ||
*/ | ||
public function testInclude($code, $vars, $result, $options = 0) | ||
{ | ||
$this->tpls(array( | ||
'welcome.tpl' => '<b>Welcome, {$username} ({$email})</b>', | ||
'recursive.tpl' => '<b>Hello, {$username} ({$email}){if false}{include "recursive.tpl"}{/if}</b>' | ||
)); | ||
$this->exec($code, $vars, $result, $options); | ||
} | ||
|
||
|