mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-11 17:43:50 +01:00
Adds support for PHP8.0, dropping support for PHP7.0 and below.
Backwards incompatible changes:
- Dropped support for php asp tags in templates (removed from php since php7.0)
- Dropped deprecated API calls that where only accessible through SmartyBC
- Dropped support for {php} and {include_php} tags and embedded PHP in templates. Embedded PHP will now be passed through as is.
- Removed all PHP_VERSION_ID and compare_version checks and conditional code blocks that are now no longer required
- Dropped deprecated SMARTY_RESOURCE_CHAR_SET and SMARTY_RESOURCE_DATE_FORMAT constants
- Dropped deprecated Smarty::muteExpectedErrors and Smarty::unmuteExpectedErrors API methods
- Dropped deprecated $smarty->getVariable() method. Use $smarty->getTemplateVars() instead.
- $smarty->registerResource() no longer accepts an array of callback functions
See the changelog for more details.
Switched CI from Travis to Github CI.
91 lines
2.5 KiB
PHP
91 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* Smarty PHPunit tests of delimiter
|
|
*
|
|
* @package PHPunit
|
|
* @author Uwe Tews
|
|
*/
|
|
|
|
/**
|
|
* class for delimiter tests
|
|
*
|
|
* @preserveGlobalState disabled
|
|
* @backupStaticAttributes enabled
|
|
*/
|
|
class AutoliteralTest extends PHPUnit_Smarty
|
|
{
|
|
public function setUp(): void
|
|
{
|
|
$this->setUpSmarty(dirname(__FILE__));
|
|
$this->smarty->addPluginsDir("../../__shared/PHPunitplugins/");
|
|
}
|
|
|
|
public function testInit()
|
|
{
|
|
$this->cleanDirs();
|
|
}
|
|
|
|
/**
|
|
* test '{ ' delimiter
|
|
*/
|
|
public function testSetAutoliteral()
|
|
{
|
|
$this->smarty->setAutoLiteral(true);
|
|
$this->smarty->assign('i','foo');
|
|
$this->assertEquals('{ $i}foo', $this->smarty->fetch('autoliteral.tpl'));
|
|
}
|
|
|
|
public function testSetAutoliteral2()
|
|
{
|
|
$this->smarty->setAutoLiteral(false);
|
|
$this->smarty->setCompileId(1);
|
|
$this->smarty->assign('i','bar');
|
|
$this->assertEquals('barbar', $this->smarty->fetch('autoliteral.tpl'));
|
|
}
|
|
/**
|
|
* test '{ ' delimiter in double quotes auto_literal true
|
|
* @runInSeparateProcess
|
|
*
|
|
*/
|
|
public function testSetAutoliteralDoublequote()
|
|
{
|
|
$this->smarty->setAutoLiteral(true);
|
|
$this->assertEquals(' output: double { counter} 1 quote', $this->smarty->fetch('autoliteraldoublequote.tpl'));
|
|
}
|
|
/**
|
|
* test '{ ' delimiter in double quotes auto_literal false
|
|
* @runInSeparateProcess
|
|
*
|
|
*/
|
|
public function testSetAutoliteralDoublequote2()
|
|
{
|
|
$this->smarty->setAutoLiteral(false);
|
|
$this->smarty->setCompileId(1);
|
|
$this->assertEquals(' output: double 1 2 quote', $this->smarty->fetch('autoliteraldoublequote.tpl'));
|
|
}
|
|
|
|
/**
|
|
* test '{{ ' delimiter in double quotes auto_literal true
|
|
* @runInSeparateProcess
|
|
*
|
|
*/
|
|
public function testSetAutoliteralDoublequote3()
|
|
{
|
|
$this->smarty->setAutoLiteral(true);
|
|
$this->assertEquals(' output: double {{ counter} {{ counter}} quote', $this->smarty->fetch('autoliteraldoublequote2.tpl'));
|
|
}
|
|
|
|
public function testSetAutoliteralBlock()
|
|
{
|
|
$this->smarty->setAutoLiteral(true);
|
|
$this->assertEquals('{ dummyblock}foo{ /dummyblock}', $this->smarty->fetch('autoliteralblock.tpl'));
|
|
}
|
|
public function testSetAutoliteralBlock1()
|
|
{
|
|
$this->smarty->setAutoLiteral(false);
|
|
$this->smarty->setCompileId(1);
|
|
$this->assertEquals('foo', $this->smarty->fetch('autoliteralblock.tpl'));
|
|
}
|
|
|
|
}
|