Add test for boolean and null

This commit is contained in:
Uwe Tews
2017-09-03 04:49:33 +02:00
parent a202d5b464
commit e3e8088029
4 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?php
/**
* Smarty PHPunit tests literals true false null
*
* @package PHPunit
* @author Uwe Tews
*/
/**
* class for {$smarty.ldelim} {$smarty.rdelim} tests
*
* @runTestsInSeparateProcess
* @preserveGlobalState disabled
* @backupStaticAttributes enabled
*/
class BooleanNullTest extends PHPUnit_Smarty
{
public function setUp()
{
$this->setUpSmarty(dirname(__FILE__));
}
public function testInit()
{
$this->cleanDirs();
}
/**
* test true
*
*/
public function testTrue() {
$this->smarty->assign('value', true);
$this->assertEquals('true', $this->smarty->fetch('eval:{if $value === true}true{else}false{/if}'));
}
/**
* test false
*
*/
public function testFalse() {
$this->smarty->assign('value', false);
$this->assertEquals('true', $this->smarty->fetch('eval:{if $value === false}true{else}false{/if}'));
}
/**
* test null
*
*/
public function testNull() {
$this->smarty->assign('value', null);
$this->assertEquals('true', $this->smarty->fetch('eval:{if $value === null}true{else}false{/if}'));
}
}