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 ********************************************************************************/
37 require_once 'modules/ModuleBuilder/parsers/views/DeployedMetaDataImplementation.php';
42 * Save & Deploy of Meetings dashlet makes non-sortable columns sortable, causing SQL Error
45 * @author arymarchik@sugarcrm.com
47 class Bug49964Test extends Sugar_PHPUnit_Framework_TestCase
49 private $_metadata = array(
50 'set_complete' => array(
52 'label' => 'LBL_LIST_CLOSE',
55 'related_fields' => array(
59 'join_meeting' => array(
61 'label' => 'LBL_LIST_JOIN_MEETING',
65 'related_fields' => array(
71 'label' => 'LBL_SUBJECT',
75 'parent_name' => array(
77 'label' => 'LBL_LIST_RELATED_TO',
79 'dynamic_module' => 'PARENT_TYPE',
83 'related_fields' => array(
91 'label' => 'LBL_DURATION',
93 'related_fields' => array(
98 'date_start' => array(
100 'label' => 'LBL_DATE',
102 'related_fields' => array(
106 'set_accept_links'=> array(
108 'label' => 'LBL_ACCEPT_THIS',
111 'related_fields' => array(
117 'label' => 'LBL_STATUS'
121 'label' => 'LBL_TYPE'
123 'date_entered' => array(
125 'label' => 'LBL_DATE_ENTERED'
127 'date_modified' => array(
129 'label' => 'LBL_DATE_MODIFIED'
131 'created_by' => array(
133 'label' => 'LBL_CREATED'
135 'assigned_user_name' => array(
137 'label' => 'LBL_LIST_ASSIGNED_USER'
139 'team_name' => array(
141 'label' => 'LBL_LIST_TEAM'
145 public function setUp()
147 global $beanList, $beanFiles;
148 require('include/modules.php');
151 $_REQUEST['view'] = 'dashlet';
152 $_REQUEST['view_module'] = 'Meetings';
153 $GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
156 public function tearDown()
159 unset($GLOBALS['app_list_strings']);
160 unset($GLOBALS['beanList']);
161 unset($GLOBALS['beanFiles']);
165 * Trying to load default metadata and compare it with origin after conversion
168 public function testHandleSave()
170 $mock = $this->getMockBuilder('DeployedMetaDataImplementation')
171 ->disableOriginalConstructor()
172 ->setMethods(array('_loadFromFile'))
174 $mock->expects($this->any())
175 ->method('_loadFromFile')
176 ->will($this->onConsecutiveCalls(null, null, null, null, $this->_metadata));
177 $mock->__construct($_REQUEST['view'], $_REQUEST['view_module']);
178 $this->assertEquals($this->_metadata, $mock->getViewdefs());