summaryrefslogtreecommitdiff
path: root/tests/UnitTests/SmartyMethodsTests/ClearAssign/ClearAssignBCTest.php
blob: b9867627158a0ed1485948a183ccb3ab960b511f (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
<?php
/**
 * Smarty PHPunit tests clearing assigned variables
 *
 * @package PHPunit
 * @author  Uwe Tews
 */

/**
 * class for clearing assigned variables tests
 *
 * @runTestsInSeparateProcess
 * @preserveGlobalState disabled
 * @backupStaticAttributes enabled
 */
class ClearAssignBCTest extends PHPUnit_Smarty
{
    public $loadSmartyBC = true;
    public $loadSmarty = false;
    public function setUp()
    {
        $this->setUpSmarty(dirname(__FILE__));

        $this->smartyBC->assign('foo', 'foo');
        $this->smartyBC->assign('bar', 'bar');
        $this->smartyBC->assign('blar', 'blar');
    }


    public function testInit()
    {
        $this->cleanDirs();
    }
    public function testSmarty2ClearAssign()
    {
        $this->smartyBC->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE | E_WARNING));
        $this->smartyBC->clear_assign('blar');
        $this->assertEquals('foobar', $this->smartyBC->fetch('eval:{$foo}{$bar}{$blar}'));
    }

    public function testSmarty2ArrayClearAssign()
    {
        $this->smartyBC->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE | E_WARNING));
        $this->smartyBC->clear_assign(array('blar', 'foo'));
        $this->assertEquals('bar', $this->smartyBC->fetch('eval:{$foo}{$bar}{$blar}'));
    }
}