2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
37 class Bug30709_Part_2_Test extends Sugar_PHPUnit_Framework_TestCase {
40 //Create the language files with bad name
41 if(file_exists('custom/include/language/en_us.lang.php')) {
42 copy('custom/include/language/en_us.lang.php', 'custom/include/language/en_us.lang.php.backup');
45 if( $fh = @fopen('custom/include/language/en_us.lang.php', 'w+') )
49 \$GLOBALS['app_list_strings'] = array (
58 'Cold Call' => 'Cold Call',
59 'Existing Customer' => 'Existing Customer',
60 'Self Generated' => 'Self Generated',
61 'Employee' => 'Employee',
62 'Partner' => 'Partner',
63 'Public Relations' => 'Public Relations',
64 'Direct Mail' => 'Direct Mail',
65 'Conference' => 'Conference',
66 'Trade Show' => 'Trade Show',
67 'Web Site' => 'Web Site',
68 'Word of mouth' => 'Word of mouth',
70 'Campaign'=>'Campaign',
73 'opportunity_type_dom' =>
76 'Existing Business' => 'Existing Business',
77 'New Business' => 'New Business',
82 'Dashboard' => 'Dashboard',
83 'Contacts' => 'Contacts',
84 'Accounts' => 'Accounts Module',
85 'Opportunities' => 'Opportunities',
90 'Meetings' => 'Meetings',
92 'Calendar' => 'Calendar',
94 'Currencies' => 'Currencies',
95 'Contracts' => 'Contracts',
97 'Products' => 'Products',
98 'ProductCategories' => 'Product Categories',
99 'ProductTypes' => 'Product Types',
100 'ProductTemplates' => 'Product Catalog',
101 'Reports' => 'Reports',
102 'Reports_1' => 'Reports',
103 'Forecasts' => 'Forecasts',
104 'ForecastSchedule' => 'Forecast Schedule',
105 'MergeRecords' => 'Merge Records',
106 'Quotas' => 'Quotas',
108 'Activities' => 'Activities',
109 'Bugs' => 'Bug Tracker',
111 'iFrames' => 'My Portal',
112 'TimePeriods' => 'Time Periods',
113 'Project' => 'Projects',
114 'ProjectTask' => 'Project Tasks',
115 'Campaigns' => 'Campaigns',
116 'CampaignLog' => 'Campaign Log',
117 'Documents' => 'Documents',
119 'WorkFlow' => 'Work Flow',
121 'Releases' => 'Releases',
122 'Prospects' => 'Targets',
123 'Queues' => 'Queues',
124 'EmailMarketing' => 'Email Marketing',
125 'EmailTemplates' => 'Email Templates',
126 'ProspectLists' => 'Target Lists',
127 'SavedSearch' => 'Saved Searches',
128 'Trackers' => 'Trackers',
129 'TrackerPerfs' => 'Tracker Performance',
130 'TrackerSessions' => 'Tracker Sessions',
131 'TrackerQueries' => 'Tracker Queries',
133 'Newsletters' => 'Newsletters',
134 'SugarFeed' => 'Sugar Feed',
135 'Library' => 'Library',
136 'EmailAddresses' => 'Email Address',
137 'KBDocuments' => 'Knowledge Base',
138 'my_personal_module' => 'My Personal Module',
142 \$GLOBALS['app_strings']['LBL_TEST'] = 'This is a test';
144 fputs( $fh, $string);
149 function tearDown() {
150 if(file_exists('custom/include/language/en_us.lang.php.backup')) {
151 copy('custom/include/language/en_us.lang.php.backup', 'custom/include/language/en_us.lang.php');
152 unlink('custom/include/language/en_us.lang.php.backup');
154 unlink('custom/include/language/en_us.lang.php');
157 if(file_exists('custom/include/language/en_us.lang.php.bak')) {
158 unlink('custom/include/language/en_us.lang.php.bak');
161 $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
162 $GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
165 function test_dropdown_fixed() {
166 require_once('modules/UpgradeWizard/uw_utils.php');
169 //Check to make sure we don't have the buggy format where '$GLOBALS["app_list_strings"] = array (...' was declared
170 $contents = file_get_contents('custom/include/language/en_us.lang.php');
171 //$this->assertFalse(preg_match('/\$GLOBALS\[\s*[\"|\']app_list_strings[\"|\']\s*\]\s+=\s+array\s+\(/', $contents));
173 unset($GLOBALS['app_list_strings']);
174 require('custom/include/language/en_us.lang.php');
175 $this->assertEquals(count($GLOBALS['app_list_strings']),2);
176 $this->assertTrue(isset($GLOBALS['app_list_strings']['moduleList']['my_personal_module']));
177 $this->assertEquals($GLOBALS['app_list_strings']['moduleList']['Accounts'],'Accounts Module');
178 $this->assertEquals(count($GLOBALS['app_strings']),1);
179 $this->assertEquals($GLOBALS['app_strings']['LBL_TEST'],'This is a test');