-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added {translate} as pair replacement for {_}
- Loading branch information
Showing
3 changed files
with
42 additions
and
8 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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Latte\Macros\CoreMacros: {_translate} | ||
* Test: Latte\Macros\CoreMacros: {translate} | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Latte\Macros\CoreMacros; | ||
use Tester\Assert; | ||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
$compiler = new Latte\Compiler; | ||
CoreMacros::install($compiler); | ||
$latte = new Latte\Engine; | ||
$latte->setLoader(new Latte\Loaders\StringLoader); | ||
|
||
// {_...} | ||
Assert::same('<?php echo LR\Filters::escapeHtmlText(($this->filters->translate)(\'var\')); ?>', $compiler->expandMacro('_', 'var', '')->openingCode); | ||
Assert::same('<?php echo LR\Filters::escapeHtmlText(($this->filters->filter)(($this->filters->translate)(\'var\'))); ?>', $compiler->expandMacro('_', 'var', '|filter')->openingCode); | ||
Assert::contains( | ||
'echo $this->filters->filterContent("translate", $ʟ_fi, \'abc\') /* line 1 */;', | ||
$latte->compile('{translate}abc{/translate}') | ||
); | ||
Assert::contains( | ||
'echo $this->filters->filterContent(\'filter\', $ʟ_fi, $this->filters->filterContent("translate", $ʟ_fi, \'abc\')) /* line 1 */;', | ||
$latte->compile('{translate|filter}abc{/translate}') | ||
); |
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,25 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Latte\Macros\CoreMacros: {_} | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Tester\Assert; | ||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
$latte = new Latte\Engine; | ||
$latte->setLoader(new Latte\Loaders\StringLoader); | ||
|
||
Assert::contains( | ||
'echo LR\Filters::escapeHtmlText(($this->filters->translate)(\'var\')) /* line 1 */;', | ||
$latte->compile('{_var}') | ||
); | ||
Assert::contains( | ||
'echo LR\Filters::escapeHtmlText(($this->filters->filter)(($this->filters->translate)(\'var\'))) /* line 1 */;', | ||
$latte->compile('{_var|filter}') | ||
); |