-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore exceptions from undefined handlers when using the guard tag
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
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
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,21 @@ | ||
<?php | ||
|
||
namespace Twig\Tests\TokenParser; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\Environment; | ||
use Twig\Loader\ArrayLoader; | ||
use Twig\Parser; | ||
use Twig\Source; | ||
|
||
class GuardTokenParserTest extends TestCase | ||
{ | ||
public function testUndefinedHandlers() | ||
{ | ||
$this->expectNotToPerformAssertions(); | ||
|
||
$env = new Environment(new ArrayLoader(), ['cache' => false, 'autoescape' => false]); | ||
$env->registerUndefinedFunctionCallback(fn ($name) => throw new \Exception('boom')); | ||
(new Parser($env))->parse($env->tokenize(new Source('{% guard function boom %}{% endguard %}', ''))); | ||
} | ||
} |