mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Add macro support
This commit is contained in:
18
tests/cases/Aspect/MacrosTest.php
Normal file
18
tests/cases/Aspect/MacrosTest.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace Aspect;
|
||||
|
||||
class MacrosTest extends TestCase {
|
||||
|
||||
public function testMacros() {
|
||||
$tpl = $this->aspect->compileCode('
|
||||
{macro plus(x, y)}
|
||||
x + y = {$x + $y}
|
||||
{/macro}
|
||||
|
||||
Math: {macro.plus x=2 y=3}
|
||||
');
|
||||
|
||||
$this->assertStringStartsWith('x + y = ', trim($tpl->macros["plus"]["body"]));
|
||||
$this->assertSame('Math: x + y = 5', Modifier::strip($tpl->fetch(array()), true));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user