-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Non-present sections should not throw an exception with the
strict_variables option
- Loading branch information
Showing
4 changed files
with
50 additions
and
4 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 |
---|---|---|
|
@@ -38,4 +38,4 @@ public function getVariableName() | |
{ | ||
return $this->variableName; | ||
} | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
test/Mustache/Test/FiveThree/Functional/StrictVariablesTest.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,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Mustache.php. | ||
* | ||
* (c) 2017 Enalean | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* @group lambdas | ||
* @group functional | ||
*/ | ||
class Mustache_Test_FiveThree_Functional_StrictVariablesTest extends PHPUnit_Framework_TestCase | ||
{ | ||
private $mustache; | ||
|
||
public function setUp() | ||
{ | ||
$this->mustache = new Mustache_Engine(array('strict_variables' => true)); | ||
} | ||
|
||
public function testStrictVariablesInSection() | ||
{ | ||
$tpl = $this->mustache->loadTemplate('{{#wrapper}}{{name}}{{/wrapper}}{{foo}}'); | ||
|
||
$this->assertEquals('bar', $tpl->render(array('foo' => 'bar'))); | ||
} | ||
|
||
public function testStrictVariablesInInvertedSections() | ||
{ | ||
$tpl = $this->mustache->loadTemplate('{{^wrapper}}{{foo}}{{/wrapper}}'); | ||
|
||
$this->assertEquals('bar', $tpl->render(array('foo' => 'bar'))); | ||
} | ||
} |