mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 05:11:36 +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.
78 lines
2.4 KiB
PHP
78 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* Smarty PHPunit tests spacing in template output
|
|
*
|
|
* @package PHPunit
|
|
* @author Uwe Tews
|
|
*/
|
|
|
|
/**
|
|
* class for spacing test
|
|
*
|
|
* @runTestsInSeparateProcess
|
|
* @preserveGlobalState disabled
|
|
* @backupStaticAttributes enabled
|
|
*/
|
|
class SpacingTest extends PHPUnit_Smarty
|
|
{
|
|
public function setUp(): void
|
|
{
|
|
$this->setUpSmarty(dirname(__FILE__));
|
|
}
|
|
|
|
public function testInit()
|
|
{
|
|
$this->cleanDirs();
|
|
}
|
|
|
|
/**
|
|
* Test spacings
|
|
*
|
|
* @preserveGlobalState disabled
|
|
* @dataProvider dataTestSpacing
|
|
* @runInSeparateProcess
|
|
*/
|
|
public function testSpacing($code, $result, $testName, $testNumber)
|
|
{
|
|
$name = empty($testName) ? $testNumber : $testName;
|
|
$file = "Spacing_{$name}.tpl";
|
|
$this->makeTemplateFile($file, $code);
|
|
$this->smarty->template_dir = './templates_tmp';
|
|
$this->smarty->assign('file', $file);
|
|
$this->smarty->assign('foo', 'bar');
|
|
$this->assertEquals($result,
|
|
$this->smarty->fetch($file),
|
|
$file);
|
|
}
|
|
|
|
/*
|
|
* Data provider für testSpacing
|
|
*/
|
|
public function dataTestSpacing()
|
|
{
|
|
$i = 1;
|
|
/*
|
|
* Code
|
|
* result
|
|
* test name
|
|
* test number
|
|
*/
|
|
return array(array('{$foo}', 'bar', 'T1', $i++),
|
|
array('{$foo}{$foo}', 'barbar', 'T2', $i++),
|
|
array('A{$foo}{$foo}B', 'AbarbarB', 'T3', $i++),
|
|
array('{$foo} {$foo}', 'bar bar', 'T4', $i++),
|
|
array('A{$foo}B', 'AbarB', 'T5', $i++),
|
|
array('A{counter}B', 'A1B', 'T6', $i++),
|
|
array('A {$foo}B', 'A barB', 'T7', $i++),
|
|
array('A{$foo} B', 'Abar B', 'T8', $i++),
|
|
array("A{\$foo}\nB", "Abar\nB", 'T9', $i++),
|
|
array("A{counter start=1}\nB", "A1\nB", 'T10', $i++),
|
|
array("A{\$foo}B\nC", "AbarB\nC", 'T11', $i++),
|
|
array("A{assign var=zoo value='blah'}B", "AB", 'T12', $i++),
|
|
array("A\n{assign var=zoo value='blah'}\nB", "A\nB", 'T13', $i++),
|
|
array("E{assign var=zoo value='blah'}\nF", "EF", 'T14', $i++),
|
|
array("G\n{assign var=zoo value='blah'}H", "G\nH", 'T15', $i++),
|
|
);
|
|
}
|
|
}
|