fenom/tests/cases/Aspect/MacrosTest.php

19 lines
450 B
PHP
Raw Normal View History

2013-02-23 02:03:05 +04:00
<?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));
}
}