Skip to content

Commit e51d55b

Browse files
committed
tests: Latte generates pretty code
1 parent a0c400e commit e51d55b

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

tests/Bridges.Latte/expected/CacheMacro.cache.inc.phtml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ class Template%a% extends Latte\Template
77
function render()
88
{
99
%A%
10-
// prolog Nette\Bridges\CacheLatte\CacheMacro
11-
Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this, $this->global);
10+
// prolog Nette\Bridges\CacheLatte\CacheMacro
11+
Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this, $this->global);
1212

13-
// main template
14-
?>
15-
<p>Included file (<?php echo LFilters::escapeHtmlText($localvar) ?>)</p>
13+
// main template
14+
?><p>Included file (<?php echo LFilters::escapeHtmlText($localvar) ?>)</p>
1615

17-
<?php if (Nette\Bridges\CacheLatte\CacheMacro::createCache($netteCacheStorage, '%[\w]+%', $this->global->caches)) { ?>
18-
<?php echo LFilters::escapeHtmlText(call_user_func($this->filters->lower, $title)) ?>
16+
<?php
17+
if (Nette\Bridges\CacheLatte\CacheMacro::createCache($netteCacheStorage, '%[\w]+%', $this->global->caches)) {
18+
?> <?php echo LFilters::escapeHtmlText(call_user_func($this->filters->lower, $title)) ?>
19+
20+
<?php
21+
$_tmp = array_pop($this->global->caches);
22+
if (!$_tmp instanceof stdClass) $_tmp->end();
23+
}
1924

20-
<?php $_tmp = array_pop($this->global->caches); if (!$_tmp instanceof stdClass) $_tmp->end(); }
2125
}
2226

2327
}

tests/Bridges.Latte/expected/CacheMacro.cache.phtml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@ class Template%a% extends Latte\Template
77
function render()
88
{
99
%A%
10-
// prolog Nette\Bridges\CacheLatte\CacheMacro
11-
Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this, $this->global);
10+
// prolog Nette\Bridges\CacheLatte\CacheMacro
11+
Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this, $this->global);
1212

13-
// main template
14-
?>
13+
// main template
14+
?>
1515
Noncached content
1616

17-
<?php if (Nette\Bridges\CacheLatte\CacheMacro::createCache($netteCacheStorage, '%[\w]+%', $this->global->caches, [$id, 'tags' => 'mytag'])) { ?>
17+
<?php
18+
if (Nette\Bridges\CacheLatte\CacheMacro::createCache($netteCacheStorage, '%[\w]+%', $this->global->caches, [$id, 'tags' => 'mytag'])) {
19+
?>
1820

1921
<h1><?php echo LFilters::escapeHtmlText(call_user_func($this->filters->upper, $title)) ?></h1>
2022

2123
<?php $this->createTemplate('include.cache.latte', ['localvar' => 11] + $this->params, "include", 'html')->render() ?>
2224

23-
<?php $_tmp = array_pop($this->global->caches); if (!$_tmp instanceof stdClass) $_tmp->end(); }
25+
<?php
26+
$_tmp = array_pop($this->global->caches);
27+
if (!$_tmp instanceof stdClass) $_tmp->end();
28+
}
29+
2430
}
2531

2632
}

0 commit comments

Comments
 (0)