mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-03 20:14:31 +02:00
Remove incomplete test cases for usesCompiler across multiple test files
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
<testsuite name="foo">
|
||||
<directory>./tests/UnitTests/</directory>
|
||||
<exclude>./tests/UnitTests/CacheResourceTests/Memcache/CacheResourceCustomMemcacheTest.php</exclude>
|
||||
<exclude>./tests/UnitTests/CacheResourceTests/Apc/CacheResourceCustomApcTest.php</exclude>
|
||||
<exclude>./tests/UnitTests/CacheModify/ModifiedSince/HttpModifiedSinceTest.php</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
+43
-41
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
|
||||
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";
|
||||
|
||||
Reference in New Issue
Block a user