Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BlockMacros: "extends check" skipped for nested blocks [Closes #227]
- Loading branch information
Showing
3 changed files
with
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Tester\Assert; | ||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
$latte = new Latte\Engine; | ||
$latte->setLoader(new Latte\Loaders\StringLoader); | ||
|
||
$template = ' | ||
{extends layout.latte} | ||
{capture $foo} | ||
{block bar}{/block} | ||
{/capture} | ||
{block content} | ||
content | ||
'; | ||
|
||
Assert::matchFile( | ||
__DIR__ . '/expected/BlockMacros.extendsCheck.phtml', | ||
$latte->compile($template) | ||
); |
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,24 @@ | ||
<?php | ||
%A% | ||
|
||
final class Template%a% extends Latte\Runtime\Template | ||
{ | ||
%A% | ||
public function main(): array | ||
{ | ||
extract($this->params); | ||
?> | ||
|
||
|
||
<?php ob_start(function () {}) ?> <?php | ||
$this->renderBlock('bar', get_defined_vars()); | ||
$__fi = new LR\FilterInfo('html'); | ||
$foo = ob_get_length() ? new LR\Html(ob_get_clean()) : ob_get_clean(); | ||
?> | ||
|
||
<?php | ||
$this->renderBlock('content', get_defined_vars()); | ||
return get_defined_vars(); | ||
} | ||
%A% | ||
} |