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 ********************************************************************************/
40 * Check if SOAP Sync from Outlook for Calls/Meetings
41 * returns proper IDs whether we use outlook_id for sync,
42 * or by matching given fields
44 * @author avucinic@sugarcrm.com
47 class Bug63559Test extends Sugar_PHPUnit_Framework_TestCase
49 public function setUp()
51 SugarTestHelper::setUp('beanList');
52 SugarTestHelper::setUp('beanFiles');
53 SugarTestHelper::setUp('current_user');
56 public function tearDown()
58 SugarTestMeetingUtilities::removeAllCreatedMeetings();
60 SugarTestHelper::tearDown();
64 * Test if set_entries returns proper IDs for Calls/Meetings
65 * with set outlook_id or with equal fields
67 * @param $module - Module name
68 * @param $outlookID - Outlook ID (must always be set, for the OPI Sync check to be initiated)
69 * @param $nameValueLists - name-value lists for set_entries call
71 * @dataProvider dataProvider
74 public function testSetEntriesOPISync($module, $outlookID, $nameValueLists)
76 $meeting = SugarTestMeetingUtilities::createMeeting();
77 // Set the fields using $nameValueLists, and resave the meeting
78 foreach ($nameValueLists[0] as $nameValue) {
79 $meeting->$nameValue['name'] = $nameValue['value'];
81 $meeting->outlook_id = $outlookID;
84 // Mock $server and $server->wsdl
85 $server = $this->getMock('soap_server', array('register'));
86 $server->wsdl = $this->getMock('wsdl', array('addComplexType'));
87 // Need name space to be set
89 require_once('soap/SoapSugarUsers.php');
90 require_once('soap/SoapError.php');
91 // Unset $NAMESPACE, it was only needed in SoapSugarUsers.php
94 $actual = handle_set_entries($module, $nameValueLists);
96 $this->assertEquals($meeting->id, $actual['ids'][0], 'Meeting not synced properly.');
99 public static function dataProvider()
102 // Test case that will be synced by outlook_id
104 'Meetings', 'outlook_id_test_same',
108 'name' => 'outlook_id',
109 'value' => 'outlook_id_test_same',
113 'value' => 'OPI Test',
116 'name' => 'date_start',
117 'value' => '2013-05-05 21:00:00',
120 'name' => 'date_end',
121 'value' => '2013-05-05',
124 'name' => 'duration_hours',
128 'name' => 'duration_minutes',
138 // Test case that will compare fields for sync
140 'Meetings', 'outlook_id_test_different',
144 'name' => 'outlook_id',
145 'value' => 'outlook_id_test',
149 'value' => 'OPI Test',
152 'name' => 'date_start',
153 'value' => '2013-05-05 21:00:00',
156 'name' => 'date_end',
157 'value' => '2013-05-05',
160 'name' => 'duration_hours',
164 'name' => 'duration_minutes',