summaryrefslogtreecommitdiff
path: root/tests/UnitTests/SmartyMethodsTests/RegisterModifier
diff options
context:
space:
mode:
authorSimon Wisselink <s.wisselink@iwink.nl>2026-05-03 22:19:50 +0200
committerSimon Wisselink <s.wisselink@iwink.nl>2026-05-03 22:19:50 +0200
commit6e648ed80922ff38fd9175c7cde2771034cf77cd (patch)
tree4ec34a41d1dc8c92b27658f751a0e3ece840b257 /tests/UnitTests/SmartyMethodsTests/RegisterModifier
parent3577fc7091f1beab0dddd881cb08fc24a2a3f741 (diff)
downloadsmarty-6e648ed80922ff38fd9175c7cde2771034cf77cd.tar.gz
smarty-6e648ed80922ff38fd9175c7cde2771034cf77cd.tar.bz2
smarty-6e648ed80922ff38fd9175c7cde2771034cf77cd.zip
Remove incomplete test cases for usesCompiler across multiple test files
Diffstat (limited to 'tests/UnitTests/SmartyMethodsTests/RegisterModifier')
-rw-r--r--tests/UnitTests/SmartyMethodsTests/RegisterModifier/RegisterModifierFirstClassCallablesTest.php72
1 files changed, 37 insertions, 35 deletions
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 @@
<?php
-// first class callables where introduced in PHP 8.1
-if (PHP_VERSION_ID >= 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');
}
+ $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 testRegisterFirstClassCallable()
+ {
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'testmodifier', eval('return strrev(...);'));
+ $this->assertEquals('mosredna', $this->smarty->fetch('string:{"andersom"|testmodifier}'));
+ }
- 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 testRegisterFirstClassCallableSameName()
+ {
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'mymodifier', eval('return strrev(...);'));
+ $this->assertEquals('mosredna', $this->smarty->fetch('string:{"andersom"|mymodifier}'));
+ }
- public function testRegisterFirstClassCallableSameNameAsPhpFunc()
- {
- $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'mymodifierfcc', eval('return strrev(...);'));
- $this->assertEquals('mosredna', $this->smarty->fetch('string:{mymodifierfcc("andersom")}'));
- }
+ 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";