Beispiel #1
0
 function tearDown()
 {
     global $db, $current_user;
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     $this->meeting = null;
     $this->call = null;
     $meetingsSql = "UPDATE meetings SET date_end = date_add(date_start, INTERVAL - CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $callsSql = "UPDATE calls SET date_end = date_add(date_start, INTERVAL - CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $db->query($meetingsSql);
     $db->query($callsSql);
     $current_user = $this->original_current_user;
 }
 function tearDown()
 {
     global $db, $current_user;
     if ($db->dbType != 'mysql') {
         return;
     }
     // No need to clean up if we skipped the test to begin with
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     $this->meeting = null;
     $this->call = null;
     $meetingsSql = "UPDATE meetings SET date_end = date_add(date_start, INTERVAL + CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $callsSql = "UPDATE calls SET date_end = date_add(date_start, INTERVAL + CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $db->query($meetingsSql);
     $db->query($callsSql);
     $current_user = $this->original_current_user;
 }
Beispiel #3
0
 /**
  * @group 58702
  * Test if Meetings/Calls/Tasks are shown properly when
  * show completed flag is set
  *
  * @dataProvider dataProvider
  */
 public function testShowCompleted($showCompleted)
 {
     // Create Held Meeting
     $meeting = SugarTestMeetingUtilities::createMeeting();
     $meeting->date_start = $GLOBALS['timedate']->nowDb();
     $meeting->date_end = $GLOBALS['timedate']->nowDb();
     $meeting->status = 'Held';
     $meeting->save();
     $meeting->set_accept_status($GLOBALS['current_user'], 'accept');
     // Create Held Call
     $call = SugarTestCallUtilities::createCall();
     $call->date_start = $GLOBALS['timedate']->nowDb();
     $call->date_end = $GLOBALS['timedate']->nowDb();
     $call->status = 'Held';
     $call->save();
     $call->set_accept_status($GLOBALS['current_user'], 'accept');
     // Create Completed Task
     $task = SugarTestTaskUtilities::createTask();
     $task->date_due = $GLOBALS['timedate']->nowDb();
     $task->status = 'Completed';
     $task->assigned_user_id = $GLOBALS['current_user']->id;
     $task->save();
     // Set query dates
     $start_date_time = $GLOBALS['timedate']->fromString(date("Y-m-d"));
     $end_date_time = $start_date_time->get("+7 days");
     $start_date_time = $start_date_time->get("-7 days");
     // Get all activities for the user
     $result = CalendarActivity::get_activities($GLOBALS['current_user']->id, true, $start_date_time, $end_date_time, 'month', true, $showCompleted);
     // Depending on show completed, get_activities should return 3 entries, the ones we created above
     if ($showCompleted) {
         $this->assertEquals(3, sizeof($result), 'get_activities did not return the Metting, Call and Task as it should have');
         $this->assertEquals($result[0]->sugar_bean->id, $meeting->id, 'Meeting not returned properly');
         $this->assertEquals($result[1]->sugar_bean->id, $call->id, 'Call not returned properly');
         $this->assertEquals($result[2]->sugar_bean->id, $task->id, 'Task not returned properly');
     } else {
         $this->assertEquals(0, sizeof($result), 'get_activities should be empty');
     }
 }
Beispiel #4
0
 public function tearDown()
 {
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
     unset($GLOBALS['app_list_strings']);
     unset($GLOBALS['app_strings']);
     unset($GLOBALS['mod_strings']);
     unset($GLOBALS['current_user']);
 }
Beispiel #5
0
 public function tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestCallUtilities::removeAllCreatedCalls();
 }
 public function tearDown()
 {
     global $current_user;
     $GLOBALS['db']->query("DELETE FROM meetings_users WHERE user_id = '{$current_user->id}'");
     $GLOBALS['db']->query("DELETE FROM calls_users WHERE user_id = '{$current_user->id}'");
     $GLOBALS['db']->query("DELETE FROM contacts_users WHERE user_id = '{$current_user->id}'");
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestTaskUtilities::removeAllCreatedTasks();
     unset($GLOBALS['current_user']);
     unset($GLOBALS['beanFiles']);
     unset($GLOBALS['beanList']);
 }