mirror of
https://github.com/smarty-php/smarty.git
synced 2025-07-31 16:37:14 +02:00
Add test to reproduce error
This commit is contained in:
@ -1,17 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty PHPunit tests getTemplateVars method
|
||||
*
|
||||
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* class for getTemplateVars method test
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
class GetTemplateVarsTest extends PHPUnit_Smarty
|
||||
{
|
||||
@ -20,7 +9,6 @@ class GetTemplateVarsTest extends PHPUnit_Smarty
|
||||
$this->setUpSmarty(__DIR__);
|
||||
}
|
||||
|
||||
|
||||
public function testInit()
|
||||
{
|
||||
$this->cleanDirs();
|
||||
@ -109,4 +97,30 @@ class GetTemplateVarsTest extends PHPUnit_Smarty
|
||||
$this->assertEquals("bar2", $data2->getTemplateVars('foo2', false));
|
||||
$this->assertEquals("", $data2->getTemplateVars('blar', false));
|
||||
}
|
||||
|
||||
/**
|
||||
* test that variable assigned by global assign in template is included in getTemplateVars
|
||||
*/
|
||||
public function testAssignedInTemplate()
|
||||
{
|
||||
$this->smarty->fetch('string:{assign var="b" value="x" scope="global"}');
|
||||
$this->assertEquals('x', $this->smarty->getTemplateVars('b'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test that getTemplateVars returns simple array of values
|
||||
*/
|
||||
public function testSimpleCallReturnsArrayWithAllValues()
|
||||
{
|
||||
$this->smarty->assign('foo', 'bar');
|
||||
$this->smarty->assign('i', 3);
|
||||
|
||||
$vars = $this->smarty->getTemplateVars();
|
||||
|
||||
$this->assertArrayHasKey('foo', $vars);
|
||||
$this->assertArrayHasKey('i', $vars);
|
||||
$this->assertEquals('bar', $vars['foo']);
|
||||
$this->assertEquals(3,$vars['i']);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user