コード例 #1
0
ファイル: VarsTest.php プロジェクト: zoddo/template
 /**
  * @depends test_block_assign_vars
  */
 public function test_destroy_block_vars(Template_test_base $tpl)
 {
     $tpl->destroy_block_vars('test.test8');
     $this->assertEquals($tpl->_bvars, array('test' => array(0 => array('test2' => 'test', 'test' => 'test6', 'test4' => 'test5', 'S_ROW_COUNT' => 0, 'S_FIRST_ROW' => true), 1 => array('test2' => 'test1', 'test' => 'test6', 'test4' => 'test5', 'S_ROW_COUNT' => 1, 'S_LAST_ROW' => true)), 'test2' => array(0 => array('test2' => 'test', 'test' => 'test6', 'test4' => 'test5', 'S_ROW_COUNT' => 0, 'S_FIRST_ROW' => true, 'S_LAST_ROW' => true))));
     $tpl->destroy_block_vars('test');
     $this->assertEquals($tpl->_bvars, array('test2' => array(0 => array('test2' => 'test', 'test' => 'test6', 'test4' => 'test5', 'S_ROW_COUNT' => 0, 'S_FIRST_ROW' => true, 'S_LAST_ROW' => true))));
     $tpl->destroy_block_vars('test2');
     $this->assertEquals($tpl->_bvars, array());
 }
コード例 #2
0
ファイル: GenerationTest.php プロジェクト: zoddo/template
 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');
 }