Smarty2 wrapper tests

This commit is contained in:
uwetews
2015-12-29 19:24:15 +01:00
parent 381556a290
commit 1d1c9bc59e

View File

@@ -37,11 +37,11 @@ class RegisterFunctionTest extends PHPUnit_Smarty
}
/**
* test wrapper rfor egister_function method for function
* test wrapper for register_function method
*/
public function testRegisterFunctionWrapper()
{
$this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'testfunction', 'myfunction');
$this->smarty->register_function('testfunction', 'myfunction');
$this->assertEquals('myfunction', $this->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['testfunction'][0]);
$this->assertEquals('hello world 1', $this->smarty->fetch('eval:{testfunction value=1}'));
}
@@ -132,6 +132,16 @@ class RegisterFunctionTest extends PHPUnit_Smarty
$this->assertFalse(isset($this->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['testfunction']));
}
/**
* test unregister_function method
*/
public function testUnregisterFunctionWrapper()
{
$this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'testfunction', 'myfunction');
$this->smarty->unregister_function('testfunction');
$this->assertFalse(isset($this->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['testfunction']));
}
/**
* test unregister->templateFunction method not registered
*/