From 6e648ed80922ff38fd9175c7cde2771034cf77cd Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Sun, 3 May 2026 22:19:50 +0200 Subject: [PATCH] Remove incomplete test cases for usesCompiler across multiple test files --- phpunit.xml | 1 - .../ResourceTests/Eval/EvalResourceTest.php | 9 -- .../ResourceTests/File/FileResourceTest.php | 6 -- .../Stream/StreamResourceTest.php | 9 -- .../String/StringResourceTest.php | 9 -- ...egisterModifierFirstClassCallablesTest.php | 84 ++++++++++--------- 6 files changed, 43 insertions(+), 75 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 4bdff288..435fdd7e 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,7 +20,6 @@ ./tests/UnitTests/ ./tests/UnitTests/CacheResourceTests/Memcache/CacheResourceCustomMemcacheTest.php - ./tests/UnitTests/CacheResourceTests/Apc/CacheResourceCustomApcTest.php ./tests/UnitTests/CacheModify/ModifiedSince/HttpModifiedSinceTest.php diff --git a/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php b/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php index faea5d2d..a52ac764 100644 --- a/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php +++ b/tests/UnitTests/ResourceTests/Eval/EvalResourceTest.php @@ -65,15 +65,6 @@ class EvalResourceTest extends PHPUnit_Smarty $this->assertEquals('', $this->smarty->fetch($tpl)); } - /** - * test usesCompiler - */ - public function testUsesCompiler() - { - $tpl = $this->smarty->createTemplate('eval:hello world'); - $this->markTestIncomplete(); - } - /** * test isEvaluated */ diff --git a/tests/UnitTests/ResourceTests/File/FileResourceTest.php b/tests/UnitTests/ResourceTests/File/FileResourceTest.php index acf522d2..68602827 100644 --- a/tests/UnitTests/ResourceTests/File/FileResourceTest.php +++ b/tests/UnitTests/ResourceTests/File/FileResourceTest.php @@ -86,12 +86,6 @@ class FileResourceTest extends PHPUnit_Smarty $this->assertEquals('hello world', $tpl->getSource()->getContent()); } - public function testUsesCompiler() - { - $tpl = $this->smarty->createTemplate('helloworld.tpl'); - $this->markTestIncomplete(); - } - public function testIsEvaluated() { $tpl = $this->smarty->createTemplate('helloworld.tpl'); diff --git a/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php b/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php index dbb14285..c6caf4b5 100644 --- a/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php +++ b/tests/UnitTests/ResourceTests/Stream/StreamResourceTest.php @@ -60,15 +60,6 @@ class StreamResourceTest extends PHPUnit_Smarty $this->assertEquals('hello world {$foo}', $tpl->getSource()->getContent()); } - /** - * test usesCompiler - */ - public function testUsesCompiler() - { - $tpl = $this->smarty->createTemplate('global:mytest'); - $this->markTestIncomplete(); - } - /** * test isEvaluated */ diff --git a/tests/UnitTests/ResourceTests/String/StringResourceTest.php b/tests/UnitTests/ResourceTests/String/StringResourceTest.php index 16a9c88b..da047c02 100644 --- a/tests/UnitTests/ResourceTests/String/StringResourceTest.php +++ b/tests/UnitTests/ResourceTests/String/StringResourceTest.php @@ -73,15 +73,6 @@ class StringResourceTest extends PHPUnit_Smarty $this->assertEquals('hello world{$foo}', $tpl->getSource()->getContent()); } - /** - * test usesCompiler - */ - public function testUsesCompiler() - { - $tpl = $this->smarty->createTemplate('string:hello world'); - $this->markTestIncomplete(); - } - /** * test isEvaluated */ diff --git a/tests/UnitTests/SmartyMethodsTests/RegisterModifier/RegisterModifierFirstClassCallablesTest.php b/tests/UnitTests/SmartyMethodsTests/RegisterModifier/RegisterModifierFirstClassCallablesTest.php index 50fdb9a0..fc99ca7f 100644 --- a/tests/UnitTests/SmartyMethodsTests/RegisterModifier/RegisterModifierFirstClassCallablesTest.php +++ b/tests/UnitTests/SmartyMethodsTests/RegisterModifier/RegisterModifierFirstClassCallablesTest.php @@ -1,50 +1,52 @@ = 80100) { - /** - * class for register modifier with (first class) callables tests - * - * @runTestsInSeparateProcess - * @preserveGlobalState disabled - * @backupStaticAttributes enabled - */ - class RegisterModifierFirstClassCallablesTest extends PHPUnit_Smarty +/** + * class for register modifier with (first class) callables tests + * + * @runTestsInSeparateProcess + * @preserveGlobalState disabled + * @backupStaticAttributes enabled + */ +class RegisterModifierFirstClassCallablesTest extends PHPUnit_Smarty +{ + public function setUp(): void { - public function setUp(): void - { - $this->setUpSmarty(__DIR__); + // First-class callable syntax (Closure::fromCallable shorthand) requires PHP 8.1+ + if (PHP_VERSION_ID < 80100) { + $this->markTestSkipped('First-class callables require PHP >= 8.1'); } - - - - public function testRegisterFirstClassCallable() - { - $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'testmodifier', eval('return strrev(...);')); - $this->assertEquals('mosredna', $this->smarty->fetch('string:{"andersom"|testmodifier}')); - } - - public function testRegisterFirstClassCallableSameName() - { - $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'mymodifier', eval('return strrev(...);')); - $this->assertEquals('mosredna', $this->smarty->fetch('string:{"andersom"|mymodifier}')); - } - - public function testRegisterFirstClassCallableAsFunc() - { - $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'kprint_r_out', eval('return strrev(...);')); - $this->smarty->assign('myVar', 'andersom'); - $this->assertEquals('mosredna', $this->smarty->fetch('string:{kprint_r_out($myVar)}')); - } - - public function testRegisterFirstClassCallableSameNameAsPhpFunc() - { - $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'mymodifierfcc', eval('return strrev(...);')); - $this->assertEquals('mosredna', $this->smarty->fetch('string:{mymodifierfcc("andersom")}')); - } - + $this->setUpSmarty(__DIR__); } + + + + public function testRegisterFirstClassCallable() + { + $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'testmodifier', eval('return strrev(...);')); + $this->assertEquals('mosredna', $this->smarty->fetch('string:{"andersom"|testmodifier}')); + } + + public function testRegisterFirstClassCallableSameName() + { + $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'mymodifier', eval('return strrev(...);')); + $this->assertEquals('mosredna', $this->smarty->fetch('string:{"andersom"|mymodifier}')); + } + + public function testRegisterFirstClassCallableAsFunc() + { + $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'kprint_r_out', eval('return strrev(...);')); + $this->smarty->assign('myVar', 'andersom'); + $this->assertEquals('mosredna', $this->smarty->fetch('string:{kprint_r_out($myVar)}')); + } + + public function testRegisterFirstClassCallableSameNameAsPhpFunc() + { + $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'mymodifierfcc', eval('return strrev(...);')); + $this->assertEquals('mosredna', $this->smarty->fetch('string:{mymodifierfcc("andersom")}')); + } + } + function mymodifierfcc($a, $b, $c) { return "$a function $b $c";