Skip to content

Commit

Permalink
[feature/append_var] Adding test case
Browse files Browse the repository at this point in the history
Adding test case for append_var

PHPBB3-10666
  • Loading branch information
cyberalien committed Mar 7, 2012
1 parent a98117b commit ebdd038
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/template/template_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,42 @@ public function test_assign_display($file, array $vars, array $block_vars, array
$this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
}

public function test_append_var_without_assign_var()
{
$this->template->set_filenames(array(
'append_var' => 'variable.html'
));

$items = array('This ', 'is ', 'a ', 'test');
$expecting = implode('', $items);

foreach ($items as $word)
{
$this->template->append_var('VARIABLE', $word);
}

$this->assertEquals($expecting, $this->display('append_var'));
}

public function test_append_var_with_assign_var()
{
$this->template->set_filenames(array(
'append_var' => 'variable.html'
));

$start = 'This ';
$items = array('is ', 'a ', 'test');
$expecting = $start . implode('', $items);

$this->template->assign_var('VARIABLE', $start);
foreach ($items as $word)
{
$this->template->append_var('VARIABLE', $word);
}

$this->assertEquals($expecting, $this->display('append_var'));
}

public function test_php()
{
$this->setup_engine(array('tpl_allow_php' => true));
Expand Down

0 comments on commit ebdd038

Please sign in to comment.