mirror of
				https://github.com/fenom-template/fenom.git
				synced 2023-08-10 21:13:07 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			450 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			450 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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));
 | |
|     }
 | |
| }
 | 
