blob: e1298e4b4a583d84d8251f60f7a5c9b4f6863b6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
/**
* Smarty PHPunit tests clearing all assigned variables
*
* @author Uwe Tews
*/
/**
* class for clearing all assigned variables tests
*/
class ClearAllAssignTest extends PHPUnit_Smarty
{
private $_data = null;
private $_tpl = null;
public function setUp(): void
{
$this->setUpSmarty(__DIR__);
$this->smarty->assign('foo', 'foo');
$this->_data = $this->smarty->createData($this->smarty);
$this->_data->assign('bar', 'bar');
$this->_tpl = $this->smarty->createTemplate('eval:{$foo}{$bar}{$blar}', null, null, $this->_data);
$this->_tpl->assign('blar', 'blar');
}
/**
* test all variables accessable
*/
public function testAllVariablesAccessable()
{
$this->assertEquals('foobarblar', $this->smarty->fetch($this->_tpl));
}
/**
* test clear all assign in template
*/
public function testClearAllAssignInTemplate()
{
error_reporting((error_reporting() & ~(E_NOTICE | E_USER_NOTICE | E_WARNING)));
$this->_tpl->clearAllAssign();
$this->assertEquals('foobar', $this->smarty->fetch($this->_tpl));
}
/**
* test clear all assign in data
*/
public function testClearAllAssignInData()
{
error_reporting((error_reporting() & ~(E_NOTICE | E_USER_NOTICE | E_WARNING)));
$this->_data->clearAllAssign();
$this->assertEquals('fooblar', $this->smarty->fetch($this->_tpl));
}
/**
* test clear all assign in Smarty object
*/
public function testClearAllAssignInSmarty()
{
error_reporting((error_reporting() & ~(E_NOTICE | E_USER_NOTICE | E_WARNING)));
$this->smarty->clearAllAssign();
$this->assertEquals('barblar', $this->smarty->fetch($this->_tpl));
}
}
|