From 0b470bef801d64369682ccc45554620c54e9902d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Nov 2017 10:24:33 +0100 Subject: [PATCH] Add phpunit for make_substitutions --- test/phpunit/FunctionsLibTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index ad12d464b8e..d2dce75b4a5 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -1140,4 +1140,23 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase return true; } + + /** + * testDolGetDate + * + * @return boolean + */ + public function testMakeSubstitutions() + { + global $conf, $langs; + $langs->load("main"); + + $substit=array("AAA"=>'Not used', "BBB"=>'Not used', "CCC"=>"C replaced"); + $chaine='This is a string with __[MAIN_THEME]__ and __(DIRECTION)__ and __CCC__'; + $newstring = make_substitutions($chaine, $substit); + $this->assertEquals($newstring, 'This is a string with eldy and ltr and __C replaced__'); + + return true; + } + }