public function test_assign_vars() { $tpl = new Template_test_base(); $tpl->assign_vars(array('test' => 'test3', 'test2' => 'test', 'test' => 'test1')); $tpl->assign_vars(array('test' => 'test6', 'test4' => 'test5')); $this->assertEquals($tpl->_vars, array('test2' => 'test', 'test' => 'test6', 'test4' => 'test5')); return $tpl; }
public function test_display() { $tpl = new Template_test_base(); $tpl->set_name(array('body' => 'body.html', 'page2' => 'page2.html')); $tpl->assign_vars(array('TITLE' => 'Page title', 'DESC' => 'Page description')); for ($i = 1; $i <= 5; $i++) { $tpl->block_assign_vars('block', array('SUBJECT' => 'Loop ' . $i, 'MESSAGE' => 'This is a loop ' . $i, 'LOOP' => $i)); for ($ii = 1; $ii <= 3; $ii++) { $tpl->block_assign_vars('block.sub', array('SUBJECT' => 'Subloop ' . $ii, 'MESSAGE' => 'This is a Subloop ' . $ii . ' of the loop ')); } } $this->expectOutputString(file_get_contents(dirname(__FILE__) . '/GenerationTest_ouput.txt')); $tpl->display('body'); }