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 ********************************************************************************/
38 require_once('include/OutboundEmail/OutboundEmail.php');
43 class Bug36329Test extends Sugar_PHPUnit_Framework_OutputTestCase
46 var $current_language;
48 public function setUp()
51 $this->save_query = isset($sugar_config['save_query']) ? true : false;
52 $this->current_language = $GLOBALS['current_language'];
55 $current_user = new User();
56 $current_user->retrieve('1');
58 global $mod_strings, $app_strings;
59 $mod_strings = return_module_language('en_us', 'Accounts');
60 $app_strings = return_application_language('en_us');
64 require('include/modules.php');
65 $GLOBALS['beanList'] = $beanList;
66 $GLOBALS['beanFiles'] = $beanFiles;
68 require('sugar_version.php');
69 $GLOBALS['sugar_version'] = $sugar_version;
72 public function tearDown()
75 if(!$this->save_query) {
76 unset($sugar_config['save_query']);
79 $GLOBALS['current_language'] = $this->current_language;
80 unset($GLOBALS['mod_strings']);
81 unset($GLOBALS['app_strings']);
82 unset($GLOBALS['beanList']);
83 unset($GLOBALS['beanFiles']);
86 public function test_populate_only_no_query()
88 $GLOBALS['sugar_config']['save_query'] = 'populate_only';
89 $_REQUEST['module'] = 'Accounts';
90 $_REQUEST['action'] = 'Popup';
91 $_REQUEST['mode'] = 'single';
92 $_REQUEST['create'] = 'true';
93 $_REQUEST['metadata'] = 'undefined';
94 require_once('include/MVC/View/SugarView.php');
95 require_once('include/MVC/View/views/view.popup.php');
96 require_once('include/utils/layout_utils.php');
97 $popup = new ViewPopup();
98 $popup->module = 'Accounts';
99 require_once('modules/Accounts/Account.php');
100 $popup->bean = new account();
101 $this->expectOutputRegex("/Perform a search using the search form above/");
106 public function test_populate_only_with_query()
108 $GLOBALS['sugar_config']['save_query'] = 'populate_only';
110 $_REQUEST['module'] = 'Accounts';
111 $_REQUEST['action'] = 'Popup';
112 $_REQUEST['mode'] = 'single';
113 $_REQUEST['create'] = 'true';
114 $_REQUEST['metadata'] = 'undefined';
115 $_REQUEST['name_advanced'] = 'Test';
116 $_REQUEST['query'] = 'true';
117 require_once('include/MVC/View/SugarView.php');
118 require_once('include/MVC/View/views/view.popup.php');
119 require_once('include/utils/layout_utils.php');
120 $popup = new ViewPopup();
121 $popup->module = 'Accounts';
122 require_once('modules/Accounts/Account.php');
123 $popup->bean = new account();
125 $this->expectOutputNotRegex('/Perform a search using the search form above/');