WIP for performance improvements.

Removed $smarty->_current_file and $smarty->allow_ambiguous_resources properties, both unused. Removed public Source::filepath property.
Cached an Compiled files (and Exceptions) no longer rely on the filepath being set. Removed explicit tests for cached and compiled filenames. The exact implementation is not important. Added tests for compile_check property, fixing a file_exists check that would always be done on source template files, even when compile_check was true. Remove code duplication between Source en Config classes. Added a local $_smarty_current_dir to the generated code files for backwards compatability for {$smarty.current_dir}.
This commit is contained in:
Simon Wisselink
2023-02-03 15:50:31 +01:00
parent cd158566d0
commit 7408c18cdc
55 changed files with 1510 additions and 1472 deletions
@@ -35,7 +35,7 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
public function testUnknownConfigFile()
{
$this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('Unable to load config \'file:foo.conf\'');
$this->expectExceptionMessage('Unable to load \'file:foo.conf\'');
$this->smarty->configLoad('foo.conf');
}
@@ -79,7 +79,7 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
public function testDefaultConfigHandlerReplacementByConfigFileFail()
{
$this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage("Unable to load config default file 'no.conf' for 'file:fo.conf'");
$this->expectExceptionMessage("Unable to load default file 'no.conf' for 'file:fo.conf'");
$this->smarty->registerDefaultConfigHandler('configHandlerFile');
$this->smarty->configLoad('fo.conf');
$this->assertEquals("123.4", $this->smarty->fetch('number.tpl'));
@@ -91,7 +91,7 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
public function testDefaultConfigHandlerReplacementReturningFalse()
{
$this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('Unable to load config \'file:foo.conf\'');
$this->expectExceptionMessage('Unable to load \'file:foo.conf\'');
$this->smarty->configLoad('foo.conf');
}