3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
39 require_once ('modules/Meetings/MeetingFormBase.php');
44 * Calendar | Meetings with status held are not displaying in the Calendar
46 * @author imatsiushyna@sugarcrm.com
49 class Bug57299Test extends Sugar_PHPUnit_Framework_OutputTestCase
54 protected $formBase = null;
59 protected $bean = null;
64 protected $name = 'Meetings';
69 protected $user = null;
71 public function setUp()
73 SugarTestHelper::setUp('beanList');
74 SugarTestHelper::setUp('beanFiles');
75 SugarTestHelper::setUp('current_user', array(true, 1));
76 SugarTestHelper::setUp('mod_strings', array($this->name));
78 $this->user = $GLOBALS['current_user'];
80 $this->user->setPreference('datef', 'm/d/Y');
81 $this->user->setPreference('timef', 'h:ia');
82 $this->user->setPreference('timezone', 'UTC');
86 public function tearDown()
90 $this->bean->db->query("DELETE FROM meetings WHERE id = '". $this->bean->id ."'");
91 $this->bean->db->query("DELETE FROM {$this->bean->rel_users_table} WHERE meeting_id = '". $this->bean->id ."'");
94 SugarTestHelper::tearDown();
97 public function getPostData()
100 'module' => 'Calendar',
101 'name' => 'Bug57299_'.time(),
102 'current_module' => $this->name,
104 'user_invitees' => '1',
105 'contact_invitees' => '',
106 'lead_invitees' => '',
107 'send_invites' => '',
108 'edit_all_recurrences' => true,
109 'repeat_parent_id' => '',
111 'repeat_interval' => '',
112 'repeat_count' => '',
113 'repeat_until' => '',
115 'appttype' => $this->name,
117 'date_start' => '11/25/2012 12:00pm',
118 'parent_type' => 'Accounts',
121 'date_end' => '11/25/2012 12:15pm',
124 'duration_hours' => 0,
125 'duration_minutes' => 15,
126 'reminder_checked' => 1,
127 'reminder_time' => 1800,
128 'email_reminder_checked' => 0,
129 'email_reminder_time' => 60,
130 'assigned_user_name' => 'Administrator',
131 'assigned_user_id' => 1,
132 'update_fields_team_name_collection' => '',
133 'team_name_new_on_update' => false,
134 'team_name_allow_update' => '',
135 'team_name_allow_new' => true,
136 'team_name' => 'team_name',
137 'team_name_field' => 'team_name_table',
138 'arrow_team_name' => 'hide',
139 'team_name_collection_0' => 'Global',
140 'id_team_name_collection_0' => 1,
141 'primary_team_name_collection' => 0,
149 * @return Array values for testing
151 public function providerData()
155 array('Held', false),
161 * Test that new Meeting created from module Calendar save in database correctly
163 * @dataProvider providerData
166 public function testDisplaysMeetingWithStatusHeldInCalendar($status, $return_module)
168 $_POST = $this->getPostData();
169 $_POST['status'] = $status;
170 $_POST['return_module'] = ($return_module) ? 'Calendar' : '';
173 $this->formBase = new MeetingFormBase();
174 $this->bean = $this->formBase->handleSave('', false, false);
176 $sql = "SELECT * FROM {$this->bean->rel_users_table} WHERE meeting_id = '". $this->bean->id . "'";
177 $result = $this->bean->db->query($sql);
178 $rows = $this->bean->db->fetchByAssoc($result);
180 //assert that if we return name of Calendar module
181 //create relation between created Meeting and current User
184 $this->assertNotNull($rows);
188 $this->assertFalse($rows);