]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/modules/UpgradeWizard/Bug30709_Part_2_Test.php
Release 6.5.16
[Github/sugarcrm.git] / tests / modules / UpgradeWizard / Bug30709_Part_2_Test.php
1 <?php
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
5  * 
6  * This program is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  * 
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
16  * details.
17  * 
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  * 
23  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25  * 
26  * The interactive user interfaces in modified source and object code versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  * 
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the "Powered by
32  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33  * technical reasons, the Appropriate Legal Notices must display the words
34  * "Powered by SugarCRM".
35  ********************************************************************************/
36
37
38 class Bug30709_Part_2_Test extends Sugar_PHPUnit_Framework_TestCase
39 {
40     protected function setUp()
41     {
42         sugar_mkdir('custom/include/language', 0777, true);
43
44         $string = <<<EOQ
45 <?php
46 \$GLOBALS['app_list_strings'] = array (
47   'test'=>array(
48     'abc' => 'ABC',
49     'cbs' => 'CBS',
50     'nbc' => 'NBC',
51   ),
52   'lead_source_dom' =>
53   array (
54     '' => '',
55     'Cold Call' => 'Cold Call',
56     'Existing Customer' => 'Existing Customer',
57     'Self Generated' => 'Self Generated',
58     'Employee' => 'Employee',
59     'Partner' => 'Partner',
60     'Public Relations' => 'Public Relations',
61     'Direct Mail' => 'Direct Mail',
62     'Conference' => 'Conference',
63     'Trade Show' => 'Trade Show',
64     'Web Site' => 'Web Site',
65     'Word of mouth' => 'Word of mouth',
66     'Email' => 'Email',
67     'Campaign'=>'Campaign',
68     'Other' => 'Other',
69   ),
70   'opportunity_type_dom' =>
71   array (
72     '' => '',
73     'Existing Business' => 'Existing Business',
74     'New Business' => 'New Business',
75   ),
76   'moduleList' =>
77   array (
78     'Home' => 'Home',
79     'Dashboard' => 'Dashboard',
80     'Contacts' => 'Contacts',
81     'Accounts' => 'Accounts Module',
82     'Opportunities' => 'Opportunities',
83     'Cases' => 'Cases',
84     'Notes' => 'Notes',
85     'Calls' => 'Calls',
86     'Emails' => 'Emails',
87     'Meetings' => 'Meetings',
88     'Tasks' => 'Tasks',
89     'Calendar' => 'Calendar',
90     'Leads' => 'Leads',
91     'Currencies' => 'Currencies',
92     'Contracts' => 'Contracts',
93     'Quotes' => 'Quotes',
94     'Products' => 'Products',
95     'ProductCategories' => 'Product Categories',
96     'ProductTypes' => 'Product Types',
97     'ProductTemplates' => 'Product Catalog',
98     'Reports' => 'Reports',
99     'Reports_1' => 'Reports',
100     'Forecasts' => 'Forecasts',
101     'ForecastSchedule' => 'Forecast Schedule',
102     'MergeRecords' => 'Merge Records',
103     'Quotas' => 'Quotas',
104     'Teams' => 'Teams',
105     'Activities' => 'Activities',
106     'Bugs' => 'Bugs',
107     'Feeds' => 'RSS',
108     'iFrames' => 'My Portal',
109     'TimePeriods' => 'Time Periods',
110     'Project' => 'Projects',
111     'ProjectTask' => 'Project Tasks',
112     'Campaigns' => 'Campaigns',
113     'CampaignLog' => 'Campaign Log',
114     'Documents' => 'Documents',
115     'Sync' => 'Sync',
116     'WorkFlow' => 'Work Flow',
117     'Users' => 'Users',
118     'Releases' => 'Releases',
119     'Prospects' => 'Targets',
120     'Queues' => 'Queues',
121     'EmailMarketing' => 'Email Marketing',
122     'EmailTemplates' => 'Email Templates',
123     'ProspectLists' => 'Target Lists',
124     'SavedSearch' => 'Saved Searches',
125     'Trackers' => 'Trackers',
126     'TrackerPerfs' => 'Tracker Performance',
127     'TrackerSessions' => 'Tracker Sessions',
128     'TrackerQueries' => 'Tracker Queries',
129     'FAQ' => 'FAQ',
130     'Newsletters' => 'Newsletters',
131     'SugarFeed' => 'Sugar Feed',
132     'Library' => 'Library',
133     'EmailAddresses' => 'Email Address',
134     'KBDocuments' => 'Knowledge Base',
135     'my_personal_module' => 'My Personal Module',
136   ),
137 );
138
139 \$GLOBALS['app_strings']['LBL_TEST'] = 'This is a test';
140 EOQ;
141
142         file_put_contents('custom/include/language/en_us.lang.php', $string);
143     }
144
145     protected function tearDown()
146     {
147         unlink('custom/include/language/en_us.lang.php');
148     }
149
150     public function testDropdownFixed()
151     {
152         require_once('modules/UpgradeWizard/uw_utils.php');
153         fix_dropdown_list();
154
155         unset($GLOBALS['app_list_strings']);
156         require('custom/include/language/en_us.lang.php');
157         $this->assertEquals(count($GLOBALS['app_list_strings']), 2);
158         $this->assertArrayHasKey('my_personal_module', $GLOBALS['app_list_strings']['moduleList']);
159         $this->assertEquals($GLOBALS['app_list_strings']['moduleList']['Accounts'], 'Accounts Module');
160         $this->assertEquals(count($GLOBALS['app_strings']), 1);
161         $this->assertEquals($GLOBALS['app_strings']['LBL_TEST'], 'This is a test');
162     }
163 }