TplBlock/test/TplBlockTest.php

27 lines
687 B
PHP
Raw Normal View History

2018-03-19 22:32:58 +01:00
<?php
use PHPUnit\Framework\TestCase;
require_once __DIR__.'/../class.TplBlock.php';
class TplBlockTest extends TestCase{
/**
* @expectedException InvalidTemplateException
*/
public function testSendEmptyNameOnSubFunction(){
$tpl = new TplBlock();
$subTpl = new TplBlock();
$tpl->add_sub_block($subTpl);
}
public function testsimpleVar(){
$tpl = new TplBlock();
$tpl->add_vars(array(
"name" => "Gnieark",
"title" => "Monsieur",
"firstname" => "Grouik"
)
);
$this->assertEquals("Hello Gnieark", $tpl->apply_tpl_str("Hello {{name}}"));
}
}