mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-02 17:34:26 +02:00
Some additional unit tests
This commit is contained in:
@@ -107,7 +107,7 @@ class CacheResourceFileTest extends CacheResourceTestCommon
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$this->cleanCacheDir();
|
||||
$this->smarty->setUseSubDirs(false);
|
||||
$this->smarty->setUseSubDirs(true);
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar', 'blar');
|
||||
$this->writeCachedContent($tpl);
|
||||
$tpl2 = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar2', 'blar');
|
||||
|
@@ -1371,4 +1371,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
||||
);
|
||||
}
|
||||
|
||||
public function testBlockWithAssign() {
|
||||
$this->assertEquals('Captured content is: Content with lots of html here', $this->smarty->fetch('038_child.tpl'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,2 @@
|
||||
{extends file='038_parent.tpl'}
|
||||
{block name=content assign=content}Content with lots of html here{/block}
|
@@ -0,0 +1 @@
|
||||
{block name=content}{/block}Captured content is: {$content}
|
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
class OperatorsTest extends PHPUnit_Smarty {
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setUpSmarty(__DIR__);
|
||||
}
|
||||
|
||||
public function testInit()
|
||||
{
|
||||
$this->cleanDirs();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group issue861
|
||||
*/
|
||||
public function testTernaries() {
|
||||
$this->assertEquals('2 equals 2', $this->smarty->fetch("string:{(2 === 2) ? '2 equals 2' : '2 ain\'t 2'}"));
|
||||
$this->assertEquals('3 equals 3', $this->smarty->fetch("string:{(3 == 3) ? '3 equals 3' : '3 ain\'t 3'}"));
|
||||
$this->assertEquals('4 equals 4', $this->smarty->fetch("string:{(4 !== 4) ? '4 ain\'t 4' : '4 equals 4'}"));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user