]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/MassUpdate/Bug43468Test.php
Release 6.2.0RC1
[Github/sugarcrm.git] / tests / include / MassUpdate / Bug43468Test.php
1 <?php
2 require_once 'include/MassUpdate.php';
3 require_once 'include/dir_inc.php';
4
5 class Bug43468Test extends Sugar_PHPUnit_Framework_TestCase
6 {
7     public function setUp()
8     {
9                 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
10                 $GLOBALS['current_user']->setPreference('datef', "Y/m/d");
11                 $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
12         }
13
14     public function tearDown()
15     {
16         SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
17         unset($GLOBALS['current_user']);
18         unset($GLOBALS['app_strings']);
19     }
20     
21     public function testGetMassUpdateForm()
22     {
23         global $current_user, $timedate;
24         $expected_dateformat = $timedate->get_cal_date_format();
25         
26         $_REQUEST['module'] = 'Calls';
27         $mass = new MassUpdate();
28         $call = new Call();
29         $call->fieldDefs['date_start']['massupdate'] = true;
30         $mass->setSugarBean($call);
31                 $form_results = $mass->getMassUpdateForm();
32                 $found_match = false;
33                 if(preg_match('/daFormat\s+?\:\s+\"(.*?)\"/', $form_results, $matches))
34                 {
35                         $this->assertEquals($expected_dateformat, $matches[1], 'Assert that the daFormat set in Calendar widget is %Y/%m/%d');
36                         $found_match = true;
37                 }
38                 $this->assertEquals($found_match, true, 'Assert that the daFormat value was set');
39     }
40  
41 }