diff options
| author | Simon Wisselink <wisskid@users.noreply.github.com> | 2024-03-29 23:32:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-29 23:32:49 +0100 |
| commit | 3232277bc526602801225ac4fbc7aae3867f582e (patch) | |
| tree | b9998cf9422d76478bf041d0c4fd9e31828efbde /tests | |
| parent | bbd09c7bfaa6c2c091adc4568a944f765bb4f1d9 (diff) | |
| download | smarty-3232277bc526602801225ac4fbc7aae3867f582e.tar.gz smarty-3232277bc526602801225ac4fbc7aae3867f582e.tar.bz2 smarty-3232277bc526602801225ac4fbc7aae3867f582e.zip | |
Fix warning when calling hasVariable for an undefined variable (#978)
Fixes #977
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/UnitTests/SmartyMethodsTests/GetTemplateVars/cache/.gitignore | 2 | ||||
| -rw-r--r-- | tests/UnitTests/SmartyMethodsTests/GetTemplateVars/templates_c/.gitignore | 2 | ||||
| -rw-r--r-- | tests/UnitTests/SmartyMethodsTests/TemplateVars/GetTemplateVarsTest.php (renamed from tests/UnitTests/SmartyMethodsTests/GetTemplateVars/GetTemplateVarsTest.php) | 0 | ||||
| -rw-r--r-- | tests/UnitTests/SmartyMethodsTests/TemplateVars/HasVariableTest.php | 32 |
4 files changed, 32 insertions, 4 deletions
diff --git a/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/cache/.gitignore b/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/cache/.gitignore deleted file mode 100644 index d88cc144..00000000 --- a/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/cache/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* diff --git a/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/templates_c/.gitignore b/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/templates_c/.gitignore deleted file mode 100644 index d88cc144..00000000 --- a/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/templates_c/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* diff --git a/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/GetTemplateVarsTest.php b/tests/UnitTests/SmartyMethodsTests/TemplateVars/GetTemplateVarsTest.php index 4aab7c3b..4aab7c3b 100644 --- a/tests/UnitTests/SmartyMethodsTests/GetTemplateVars/GetTemplateVarsTest.php +++ b/tests/UnitTests/SmartyMethodsTests/TemplateVars/GetTemplateVarsTest.php diff --git a/tests/UnitTests/SmartyMethodsTests/TemplateVars/HasVariableTest.php b/tests/UnitTests/SmartyMethodsTests/TemplateVars/HasVariableTest.php new file mode 100644 index 00000000..047af7b9 --- /dev/null +++ b/tests/UnitTests/SmartyMethodsTests/TemplateVars/HasVariableTest.php @@ -0,0 +1,32 @@ +<?php + +/** + * Tests the ::hasVariable method + */ +class HasVariableTest extends PHPUnit_Smarty +{ + public function setUp(): void + { + $this->setUpSmarty(__DIR__); + } + + + public function testInit() + { + $this->cleanDirs(); + } + + public function testSimpleTrue() + { + $this->smarty->assign('foo', 'bar'); + $this->assertTrue($this->smarty->hasVariable('foo')); + } + + + public function testSimpleFalse() + { + $this->smarty->assign('foo', 'bar'); + $this->assertFalse($this->smarty->hasVariable('foox')); + } + +} |
