-
Notifications
You must be signed in to change notification settings - Fork 701
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
16 changed files
with
144 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
|
||
phpunit* | ||
.phpunit.result.cache | ||
/vendor/* | ||
/composer.lock | ||
vendor/* | ||
composer.lock |
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
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
2 changes: 2 additions & 0 deletions
2
tests/UnitTests/SmartyMethodsTests/CompileCheck/templates_c/.gitignore
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,2 @@ | ||
# Ignore anything in here, but keep this directory | ||
* |
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
2 changes: 2 additions & 0 deletions
2
tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/038_child.tpl
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,2 @@ | ||
{extends file='038_parent.tpl'} | ||
{block name=content assign=content}Content with lots of html here{/block} |
1 change: 1 addition & 0 deletions
1
tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/038_parent.tpl
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 @@ | ||
{block name=content}{/block}Captured content is: {$content} |
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
46 changes: 46 additions & 0 deletions
46
tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStripTagsTest.php
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,46 @@ | ||
<?php | ||
/** | ||
* Smarty PHPunit tests of modifier | ||
*/ | ||
|
||
namespace UnitTests\TemplateSource\TagTests\PluginModifier; | ||
use PHPUnit_Smarty; | ||
|
||
/** | ||
* class for modifier tests | ||
* | ||
* @runTestsInSeparateProcess | ||
* @preserveGlobalState disabled | ||
* @backupStaticAttributes enabled | ||
*/ | ||
class PluginModifierStripTagsTest extends PHPUnit_Smarty { | ||
|
||
public function setUp(): void { | ||
$this->setUpSmarty(__DIR__); | ||
} | ||
|
||
public function testDefault() { | ||
$tpl = $this->smarty->createTemplate('string:{$x|strip_tags}'); | ||
$tpl->assign('x', '<b>hi</b>'); | ||
$this->assertEquals(" hi ", $this->smarty->fetch($tpl)); | ||
} | ||
|
||
public function testParam1() { | ||
$tpl = $this->smarty->createTemplate('string:{$x|strip_tags:false}'); | ||
$tpl->assign('x', '<b>hi</b>'); | ||
$this->assertEquals("hi", $this->smarty->fetch($tpl)); | ||
} | ||
|
||
public function testInputIsFalsy0() { | ||
$tpl = $this->smarty->createTemplate('string:{$x|strip_tags}'); | ||
$tpl->assign('x', 0); | ||
$this->assertEquals("0", $this->smarty->fetch($tpl)); | ||
} | ||
|
||
public function testInputIsFalsy1() { | ||
$tpl = $this->smarty->createTemplate('string:{$x|strip_tags}'); | ||
$tpl->assign('x', ''); | ||
$this->assertEquals("", $this->smarty->fetch($tpl)); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
tests/UnitTests/TemplateSource/ValueTests/Operators/OperatorsTest.php
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,23 @@ | ||
<?php | ||
|
||
class OperatorsTest extends PHPUnit_Smarty { | ||
public function setUp(): void | ||
{ | ||
$this->setUpSmarty(__DIR__); | ||
} | ||
|
||
public function testInit() | ||
{ | ||
$this->cleanDirs(); | ||
} | ||
|
||
/** | ||
* @group issue861 | ||
*/ | ||
public function testTernaries() { | ||
$this->assertEquals('2 equals 2', $this->smarty->fetch("string:{(2 === 2) ? '2 equals 2' : '2 ain\'t 2'}")); | ||
$this->assertEquals('3 equals 3', $this->smarty->fetch("string:{(3 == 3) ? '3 equals 3' : '3 ain\'t 3'}")); | ||
$this->assertEquals('4 equals 4', $this->smarty->fetch("string:{(4 !== 4) ? '4 ain\'t 4' : '4 equals 4'}")); | ||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
tests/UnitTests/TemplateSource/ValueTests/Operators/templates_c/.gitignore
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,2 @@ | ||
# Ignore anything in here, but keep this directory | ||
* |