Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error message when calling parent() in a block that doesn't exist
- Loading branch information
Showing
4 changed files
with
25 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
11 changes: 11 additions & 0 deletions
11
test/Twig/Tests/Fixtures/functions/block_without_parent.test
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,11 @@ | ||
--TEST-- | ||
"block" calling parent() with no definition in parent template | ||
--TEMPLATE-- | ||
{% extends "parent.twig" %} | ||
{% block label %}{{ parent() }}{% endblock %} | ||
--TEMPLATE(parent.twig)-- | ||
{{ block('label') }} | ||
--DATA-- | ||
return array() | ||
--EXCEPTION-- | ||
Twig_Error_Runtime: Block "label" should not call parent() in "index.twig" as the block does not exist in the parent template "parent.twig" in "index.twig" at line 3. |
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