Feature/php8 support (#629)

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.
This commit is contained in:
Simon Wisselink
2021-10-13 12:15:17 +02:00
committed by GitHub
parent 9d4f8309ed
commit 39b69f0142
276 changed files with 3766 additions and 6812 deletions
+14 -48
View File
@@ -7,36 +7,16 @@
/**
* Smarty Test Case Fixture
*/
class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
class PHPUnit_Smarty extends PHPUnit\Framework\TestCase
{
/**
* Smarty object
*
* @var SmartyBC
*/
public $smartyBC = null;
/**
* SmartyBC object
* Smarty object
*
* @var Smarty
*/
public $smarty = null;
/**
* Flag if test is using the Smarty object
*
* @var bool
*/
public $loadSmarty = true;
/**
* Flag if test is using the SmartyBC object
*
* @var bool
*/
public $loadSmartyBC = false;
/**
* Flag for initialization at first test
*
@@ -86,7 +66,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
* This method is called before the first test of this test class is run.
*
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
error_reporting(E_ALL & ~E_STRICT);
self::$init = true;
@@ -97,7 +77,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
* This method is called after the last test of this test class is run.
*
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
//self::$pdo = null;
self::$testNumber = 0;
@@ -161,23 +141,15 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
self::$init = false;
}
clearstatcache();
// instance Smarty class
if ($this->loadSmarty) {
$this->smarty = new Smarty;
if (individualFolders != 'true') {
$this->smarty->setCompileDir(dirname(__FILE__) . '/templates_c');
$this->smarty->setCacheDir(dirname(__FILE__) . '/cache');
}
$this->smarty = new Smarty;
if (individualFolders != 'true') {
$this->smarty->setCompileDir(dirname(__FILE__) . '/templates_c');
$this->smarty->setCacheDir(dirname(__FILE__) . '/cache');
}
// instance SmartyBC class
if ($this->loadSmartyBC) {
$this->smartyBC = new SmartyBC;
if (individualFolders != 'true') {
$this->smartyBC->setCompileDir(dirname(__FILE__) . '/templates_c');
$this->smartyBC->setCacheDir(dirname(__FILE__) . '/cache');
}
}
$smarty = $this->getSmartyObj();
$this->getSmartyObj();
}
/**
@@ -658,10 +630,10 @@ KEY `name` (`name`)
/**
* Gat Smarty object
* @return null|\Smarty|\SmartyBC
* @return null|\Smarty
*/
public function getSmartyObj(){
return isset($this->smarty) ? $this->smarty : (isset($this->smartyBC) ? $this->smartyBC : null);
return $this->smarty;
}
public static function getSmartyPluginsDir(){
@@ -676,7 +648,7 @@ KEY `name` (`name`)
* This method is called after a test is executed.
*
*/
protected function tearDown()
protected function tearDown(): void
{
if (class_exists('Smarty_Internal_TemplateCompilerBase') &&
isset(Smarty_Internal_TemplateCompilerBase::$_tag_objects)
@@ -689,11 +661,5 @@ KEY `name` (`name`)
if (isset($this->smarty)) {
$this->smarty = null;
}
if (isset($this->smartyBC->smarty)) {
$this->smartyBC->smarty = null;
}
if (isset($this->smartyBC)) {
$this->smartyBC = null;
}
}
}