diff options
| author | Simon Wisselink <s.wisselink@iwink.nl> | 2023-10-22 23:55:07 +0200 |
|---|---|---|
| committer | Simon Wisselink <s.wisselink@iwink.nl> | 2023-10-22 23:55:07 +0200 |
| commit | 9ee3cce380434b1f4802943da339ca192c026dde (patch) | |
| tree | a2d4a8f0171b8edb846312fb9ebb9768e4da7a34 /tests | |
| parent | babec0f29b47fb878d4b144913c6f1e567b186ec (diff) | |
| download | smarty-9ee3cce380434b1f4802943da339ca192c026dde.tar.gz smarty-9ee3cce380434b1f4802943da339ca192c026dde.tar.bz2 smarty-9ee3cce380434b1f4802943da339ca192c026dde.zip | |
Added some extra unit test
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php b/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php index 473cbb0b..81549525 100644 --- a/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php +++ b/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php @@ -154,7 +154,7 @@ class RegisterFunctionTest extends PHPUnit_Smarty public function testUnregisterFunctionNotRegistered() { $this->smarty->unregisterPlugin(Smarty::PLUGIN_FUNCTION, 'testfunction'); - $this->assertNull($this->smarty->getRegisteredPlugin(Smarty::PLUGIN_FUNCTION, 'testfunction')); + $this->assertNull($this->smarty->getRegisteredPlugin(Smarty::PLUGIN_FUNCTION, 'testfunction')); } /** @@ -164,18 +164,32 @@ class RegisterFunctionTest extends PHPUnit_Smarty { $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'testfunction', 'myfunction'); $this->smarty->unregisterPlugin(Smarty::PLUGIN_FUNCTION, 'testfunction'); - $this->assertIsArray($this->smarty->getRegisteredPlugin(Smarty::PLUGIN_BLOCK, 'testfunction')); + $this->assertIsArray($this->smarty->getRegisteredPlugin(Smarty::PLUGIN_BLOCK, 'testfunction')); } + /** * Test case (in)sensitivy of plugin functions + * @param $registerName + * @param $templateString * @return void * @throws \Smarty\Exception * @group issue907 + * @dataProvider dataProviderForCaseSensitivity */ - public function testCaseSensitivity() { - $this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'customTag', 'myfunction'); - $this->assertEquals('hello world ', $this->smarty->fetch('string:{customTag}')); + public function testCaseSensitivity($registerName, $templateString) { + $this->smarty->registerPlugin( + Smarty::PLUGIN_FUNCTION, + $registerName, + function($params, $smarty) { return 'function-output'; }); + $this->assertEquals('function-output', $this->smarty->fetch('string:' . $templateString)); + } + + public function dataProviderForCaseSensitivity() { + return [ + ['customTag', '{customTag}'], + ['customtag', '{customtag}'], + ]; } } |
