mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
Smarty2 wrapper tests
This commit is contained in:
@@ -38,17 +38,6 @@ class RegisterFunctionTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals('hello world 1', $this->smarty->fetch('string:{testfunction value=1}'));
|
$this->assertEquals('hello world 1', $this->smarty->fetch('string:{testfunction value=1}'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* test wrapper for register_function method
|
|
||||||
*/
|
|
||||||
public function testRegisterFunctionWrapper()
|
|
||||||
{
|
|
||||||
$this->smarty->register_function('testfunction', 'myfunction');
|
|
||||||
$this->assertEquals('myfunction',
|
|
||||||
$this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ 'testfunction' ][ 0 ]);
|
|
||||||
$this->assertEquals('hello world 12', $this->smarty->fetch('string:{testfunction value=12}'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test SmartyBC for register_function method
|
* test SmartyBC for register_function method
|
||||||
*/
|
*/
|
||||||
@@ -70,15 +59,6 @@ class RegisterFunctionTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals('hello world 2', $this->smarty->fetch('string:{testfunction value=2}'));
|
$this->assertEquals('hello world 2', $this->smarty->fetch('string:{testfunction value=2}'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* test register_function wrapper method for function plugin by class
|
|
||||||
*/
|
|
||||||
public function testRegisterFunctionClassWrapper()
|
|
||||||
{
|
|
||||||
$this->smarty->register_function('testfunction', array('myfunctionclass', 'execute'));
|
|
||||||
$this->assertEquals('hello world 12', $this->smarty->fetch('string:{testfunction value=12}'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test register_function SmartyBC method for function plugin by class
|
* test register_function SmartyBC method for function plugin by class
|
||||||
*/
|
*/
|
||||||
@@ -98,16 +78,6 @@ class RegisterFunctionTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals('hello world 3', $this->smarty->fetch('string:{testfunction value=3}'));
|
$this->assertEquals('hello world 3', $this->smarty->fetch('string:{testfunction value=3}'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* test register_function wrapper method for function plugin by object
|
|
||||||
*/
|
|
||||||
public function testRegisterFunctionObjectWrapper()
|
|
||||||
{
|
|
||||||
$myfunction_object = new myfunctionclass;
|
|
||||||
$this->smarty->register_function('testfunction', array($myfunction_object, 'execute'));
|
|
||||||
$this->assertEquals('hello world 13', $this->smarty->fetch('string:{testfunction value=13}'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test register_function SmartyBC method for function plugin by object
|
* test register_function SmartyBC method for function plugin by object
|
||||||
*/
|
*/
|
||||||
@@ -222,16 +192,6 @@ class RegisterFunctionTest extends PHPUnit_Smarty
|
|||||||
$this->assertFalse(isset($this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ 'testfunction' ]));
|
$this->assertFalse(isset($this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ 'testfunction' ]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* test unregister_function method
|
|
||||||
*/
|
|
||||||
public function testUnregisterFunctionWrapper()
|
|
||||||
{
|
|
||||||
$this->smarty->register_function('testfunction', 'myfunction');
|
|
||||||
$this->smarty->unregister_function('testfunction');
|
|
||||||
$this->assertFalse(isset($this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ 'testfunction' ]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUnregisterFunctionSmartyBC()
|
public function testUnregisterFunctionSmartyBC()
|
||||||
{
|
{
|
||||||
$this->smartyBC->register_function('testfunction', 'myfunction');
|
$this->smartyBC->register_function('testfunction', 'myfunction');
|
||||||
|
Reference in New Issue
Block a user