-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix warning when calling hasVariable for an undefined variable (#978)
Fixes #977
- Loading branch information
Showing
6 changed files
with
34 additions
and
5 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fix warning when calling hasVariable for an undefined variable [#977](https://github.com/smarty-php/smarty/issues/977) |
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: 0 additions & 2 deletions
2
tests/UnitTests/SmartyMethodsTests/GetTemplateVars/cache/.gitignore
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
tests/UnitTests/SmartyMethodsTests/GetTemplateVars/templates_c/.gitignore
This file was deleted.
Oops, something went wrong.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
tests/UnitTests/SmartyMethodsTests/TemplateVars/HasVariableTest.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,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')); | ||
} | ||
|
||
} |