2020-04-13 15:30:52 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Smarty PHPunit tests assign method
|
|
|
|
*
|
|
|
|
* @package PHPunit
|
|
|
|
* @author Uwe Tews
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* class for assign tests
|
|
|
|
*
|
|
|
|
* @runTestsInSeparateProcess
|
|
|
|
* @preserveGlobalState disabled
|
|
|
|
* @backupStaticAttributes enabled
|
|
|
|
*/
|
|
|
|
class AssignTest extends PHPUnit_Smarty
|
|
|
|
{
|
2021-10-13 12:15:17 +02:00
|
|
|
public function setUp(): void
|
2020-04-13 15:30:52 +02:00
|
|
|
{
|
2022-09-27 13:03:34 +03:00
|
|
|
$this->setUpSmarty(__DIR__);
|
2020-04-13 15:30:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function testInit()
|
|
|
|
{
|
|
|
|
$this->cleanDirs();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* test simple assign
|
|
|
|
*/
|
|
|
|
public function testSimpleAssign()
|
|
|
|
{
|
|
|
|
$this->smarty->assign('foo', 'bar');
|
|
|
|
$this->assertEquals('bar', $this->smarty->fetch('eval:{$foo}'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* test assign array of variables
|
|
|
|
*/
|
|
|
|
public function testArrayAssign()
|
|
|
|
{
|
|
|
|
$this->smarty->assign(array('foo' => 'bar', 'foo2' => 'bar2'));
|
|
|
|
$this->assertEquals('bar bar2', $this->smarty->fetch('eval:{$foo} {$foo2}'));
|
|
|
|
}
|
|
|
|
}
|