fenom/tests/cases/Aspect/Template/ExtendsTest.php

38 lines
1.4 KiB
PHP
Raw Normal View History

2013-02-13 20:51:27 +04:00
<?php
namespace Aspect\Template;
2013-02-15 01:49:26 +04:00
use Aspect, Aspect\Modifier, Aspect\TestCase;
2013-02-13 20:51:27 +04:00
2013-02-15 01:49:26 +04:00
class ExtendsTest extends TestCase {
2013-02-13 20:51:27 +04:00
public static function providerExtends() {
return array(
array('{extends "parent.tpl"}{block "bk1"} block1 {/block}', "Template extended by block1"),
array('{extends "parent.tpl"}{block "bk1"} block1 {/block}{block "bk2"} block2 {/block} garbage', "Template extended by block1"),
array('{extends "parent.tpl"}{block "bk1"} block1 {/block}{block "bk2"} block2 {/block} {block "bk3"} block3 {/block} garbage', "Template multi-extended by block1"),
array('{extends "parent.tpl"}{var $bk = "bk3"}{block "bk1"} block1 {/block}{block "bk2"} block2 {/block} {block "$bk"} block3 {/block} garbage', "Template multi-extended by block1"),
);
}
/**
* @group extends
*/
2013-02-15 01:49:26 +04:00
public function testParentLevel() {
//echo($this->aspect->getTemplate("parent.tpl")->_body); exit;
$this->assertSame($this->aspect->fetch("parent.tpl", array("a" => "a char")), "Parent template\nBlock1: Block2: Block3: default");
2013-02-13 20:51:27 +04:00
}
/**
* @group extends
*/
2013-02-15 01:49:26 +04:00
public function testChildLevel1() {
//echo($this->aspect->fetch("child1.tpl", array("a" => "a char"))); exit;
2013-02-13 20:51:27 +04:00
}
/**
* @group extends
*/
2013-02-15 01:49:26 +04:00
public function _testChildLevel3() {
echo($this->aspect->getTemplate("child3.tpl")->getBody()); exit;
2013-02-13 20:51:27 +04:00
}
}