loadString('ABC123'); $tpl->setParam('test', 'abc'); $this->assertEquals('ABCabc123', $tpl->getDocument(), 'Unexpected result'); } public function testLoop() { $tpl = new CTemplate(); $tpl->loadString('ABC123'); $tpl->setParam('test',array('a','b','c')); $this->assertEquals('ABCabc123', $tpl->getDocument(), 'Unexpected result'); } public function testFile() { $template = new CTemplate(); $template->loadTemplate(BASEDIR.'/testdata/ctemplate/template.php'); $template->setParam('testVal', 'OK'); $v2 = new stdClass(); $v2->v = 'OK'; $template->setParam('testObj', $v2); $template->setParam('testCon', true); $param = $template->getParamParams('testVal2'); $template->setParam('testVal2CSS', $param['css']); $template->setParam('testVal2', 'OK'); $template->setParam('testLoop', array('O','K',' ','O','K')); $data2 = []; $o = new \stdClass(); $o->a = 'A'; $o->b = [1,2,3]; $data2[] = $o; $o = new \stdClass(); $o->a = 'B'; $o->b = [4,5,6]; $data2[] = $o; $template->setParam('testLoop2', $data2); // echo $template->getDocument(); } }