2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2013 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 ********************************************************************************/
38 require_once('include/OutboundEmail/OutboundEmail.php');
43 class Bug36329Test extends Sugar_PHPUnit_Framework_OutputTestCase
46 var $current_language;
48 public function setUp()
51 if(isset($sugar_config['save_query']))
53 $this->save_query = $sugar_config['save_query'];
55 $this->current_language = $GLOBALS['current_language'];
58 $current_user = new User();
59 $current_user->retrieve('1');
61 global $mod_strings, $app_strings;
62 $mod_strings = return_module_language('en_us', 'Accounts');
63 $app_strings = return_application_language('en_us');
67 require('include/modules.php');
68 $GLOBALS['beanList'] = $beanList;
69 $GLOBALS['beanFiles'] = $beanFiles;
71 require('sugar_version.php');
72 $GLOBALS['sugar_version'] = $sugar_version;
75 public function tearDown()
78 if(!empty($this->save_query)) {
79 $sugar_config['save_query'] = $this->save_query;
82 $GLOBALS['current_language'] = $this->current_language;
83 //unset($GLOBALS['mod_strings']);
84 //unset($GLOBALS['app_strings']);
85 //unset($GLOBALS['beanList']);
86 //unset($GLOBALS['beanFiles']);
89 public function test_populate_only_no_query()
91 $GLOBALS['sugar_config']['save_query'] = 'populate_only';
92 $_REQUEST['module'] = 'Accounts';
93 $_REQUEST['action'] = 'Popup';
94 $_REQUEST['mode'] = 'single';
95 $_REQUEST['create'] = 'true';
96 $_REQUEST['metadata'] = 'undefined';
97 require_once('include/MVC/View/SugarView.php');
98 require_once('include/MVC/View/views/view.popup.php');
99 require_once('include/utils/layout_utils.php');
100 $popup = new ViewPopup();
101 $popup->module = 'Accounts';
102 require_once('modules/Accounts/Account.php');
103 $popup->bean = new account();
104 $this->expectOutputRegex("/Perform a search using the search form above/");
109 public function test_populate_only_with_query()
111 $GLOBALS['sugar_config']['save_query'] = 'populate_only';
113 $_REQUEST['module'] = 'Accounts';
114 $_REQUEST['action'] = 'Popup';
115 $_REQUEST['mode'] = 'single';
116 $_REQUEST['create'] = 'true';
117 $_REQUEST['metadata'] = 'undefined';
118 $_REQUEST['name_advanced'] = 'Test';
119 $_REQUEST['query'] = 'true';
120 require_once('include/MVC/View/SugarView.php');
121 require_once('include/MVC/View/views/view.popup.php');
122 require_once('include/utils/layout_utils.php');
123 $popup = new ViewPopup();
124 $popup->module = 'Accounts';
125 require_once('modules/Accounts/Account.php');
126 $popup->bean = new account();
128 $this->expectOutputNotRegex('/Perform a search using the search form above/');