]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/Smarty/plugins/FunctionSugarHelpTest.php
Added unit tests.
[Github/sugarcrm.git] / tests / include / Smarty / plugins / FunctionSugarHelpTest.php
1 <?php
2 require_once 'include/Smarty/plugins/function.sugar_help.php';
3 require_once 'include/Sugar_Smarty.php';
4
5 class FunctionSugarHelpTest extends Sugar_PHPUnit_Framework_TestCase
6 {
7     public function setUp()
8     {
9         $this->_smarty = new Sugar_Smarty;
10     }
11     
12     public function providerSpecialCharactersHandledInTextParameter()
13     {
14         return array(
15             array(
16                 'dog "the" bounty hunter & friends are <b>cool</b>',
17                 'dog &quot;the&quot; bounty hunter &amp; friends are &lt;b&gt;cool&lt;/b&gt;',
18                 ),
19             array(
20                 "dog 'the' bounty hunter",
21                 "dog \'the\' bounty hunter"
22                 ),
23             );
24     }
25     
26     /**
27      * @dataProvider providerSpecialCharactersHandledInTextParameter
28      */
29         public function testSpecialCharactersHandledInTextParameter(
30         $string,
31         $returnedString
32         )
33     {
34         $this->assertContains($returnedString, smarty_function_sugar_help(array('text'=>$string),$this->_smarty));
35     }
36     
37     public function testExtraParametersAreAdded()
38     {
39         $string = 'my string';
40         
41         $output = smarty_function_sugar_help(array('text'=>$string,'foo'=>'bar'),$this->_smarty);
42         
43         $this->assertContains(",foo,bar",$output);
44     }
45 }