public function setUp() { $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->contact_id = $this->contact->id; $this->task->save(); }
public function setUp() { $GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']); $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->contact_id = $this->contact->id; $this->task->save(); }
public function setUp() { SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('app_strings'); SugarTestHelper::setUp('current_user'); $this->contact = SugarTestContactUtilities::createContact(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->contact_id = $this->contact->id; $this->task->save(); }
public function setUp() { $this->timedate = new TimeDate(); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $meeting = SugarTestMeetingUtilities::createMeeting(); $meeting->name = "VeryImportantMeeting"; $meeting->date_start = $this->timedate->to_display_date_time(gmdate("Y-m-d H:i:s", mktime(12, 30, 00, date("m"), date("d") + 1, date("Y")))); $meeting->save(); $GLOBALS['db']->query(sprintf("INSERT INTO meetings_users (id, meeting_id, user_id, required, accept_status, date_modified, deleted) VALUES ('%s', '%s', '%s', '1', 'none', NULL, '0')", create_guid(), $meeting->id, $GLOBALS['current_user']->id)); $task = SugarTestTaskUtilities::createTask(); $task->assigned_user_id = $GLOBALS['current_user']->id; $task->name = "VeryImportantTask"; $task->save(); $this->project = SugarTestProjectUtilities::createProject(); $projectId = $this->project->id; $projectTaskData = array('project_id' => $projectId, 'parent_task_id' => '', 'project_task_id' => 1, 'percent_complete' => 50, 'name' => 'VeryImportantProjectTask'); $projectTask = SugarTestProjectTaskUtilities::createProjectTask($projectTaskData); $projectTask->assigned_user_id = $GLOBALS['current_user']->id; $projectTask->save(); }
/** * @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'); } }
public function setUp() { global $timedate, $current_user; $timedate = TimeDate::getInstance(); require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; $current_user = SugarTestUserUtilities::createAnonymousUser(); $this->nowTime = $timedate->asDb($timedate->getNow()->get("-10 minutes")); $this->tenMinutesLaterTime = $timedate->asDb($timedate->getNow()->get("+10 minutes")); $current_user->is_admin = 1; $current_user->save(); $this->meeting = SugarTestMeetingUtilities::createMeeting(); $this->meeting->team_id = $current_user->team_id; $this->meeting->team_set_id = $current_user->team_set_id; $this->meeting->team_id = $current_user->team_id; $this->meeting->team_set_id = $current_user->team_set_id; $this->meeting->assigned_user_id = $current_user->id; $this->meeting->save(); $this->meeting->load_relationship('users'); $this->meeting->users->add($current_user); $this->call = SugarTestCallUtilities::createCall(); $this->call->team_id = $current_user->team_id; $this->call->team_set_id = $current_user->team_set_id; $this->call->assigned_user_id = $current_user->id; $this->call->save(); $this->call->load_relationships('users'); $this->call->users->add($current_user); $this->contact = SugarTestContactUtilities::createContact(); $this->contact->email1 = '*****@*****.**'; $this->contact->contacts_users_id = $current_user->id; $this->contact->load_relationship('user_sync'); $this->contact->user_sync->add($current_user); $this->contact->sync_contact = 1; $this->contact->save(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->assigned_user_id = $current_user->id; $this->task->team_id = $current_user->id; $this->task->team_set_id = $current_user->id; $this->task->save(); //$this->useOutputBuffering = false; /** * This provider returns an Array of Array data. Each Array contains the following data * 0 => String - Left side module name * 1 => String - Right side module name * 2 => String - Relationship Query * 3 => boolean to return deleted records or not (this is actually ignored by the function) * 4 => integer offset to start with * 5 => integer value for the maximum number of results * 6 => array of fields to select and return * 7 => load_relationships - Relationship name to use * 8 => array of expected results * 9 => integer of expected total count * 10 => array of expected soap error * @return array The provider array */ $this->testData = array(array('Users', 'Meetings', "( (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND m1.deleted = 0) OR (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND m1.deleted = 1) AND m1.id IN ('{$this->meeting->id}')) OR (m1.id NOT IN ('{$this->meeting->id}') AND m1.deleted = 0) AND m2.id = '{$current_user->id}'", 0, 0, 3000, $this->callsAndMeetingsSelectFields, 'meetings_users', array('id' => $this->meeting->id), 1, $this->noSoapErrorArray), array('Users', 'Calls', "( m1.deleted = 0) AND m2.id = '{$current_user->id}'", 0, 0, 3000, $this->callsAndMeetingsSelectFields, 'calls_users', array('id' => $this->call->id), 1, $this->noSoapErrorArray), array('Users', 'Contacts', "( (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 0) OR ({0}.date_modified > '{$this->nowTime}' AND {0}.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 1) AND m1.id IN ('31a219bd-b9c1-2c3e-aa5d-4f2778ab0347','c794bc39-e4fb-f515-f1d5-4f285ca88965','d51a0555-8f84-9e62-0fbc-4f2787b5d839','a1219ae6-5a6b-0d1b-c49f-4f2854bc2912')) OR (m1.id NOT IN ('31a219bd-b9c1-2c3e-aa5d-4f2778ab0347','c794bc39-e4fb-f515-f1d5-4f285ca88965','d51a0555-8f84-9e62-0fbc-4f2787b5d839','a1219ae6-5a6b-0d1b-c49f-4f2854bc2912') AND {0}.deleted = 0) AND m2.id = '1'", 0, 0, 3000, $this->contactsSelectFields, 'contacts_users', array('id' => $this->contact->id, 'email1' => '*****@*****.**'), 1, $this->noSoapErrorArray), array('Users', 'Tasks', " ( (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 0) OR ({0}.date_modified > '{$this->nowTime}' AND {0}.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 1) AND m1.id IN ('{$this->task->id}')) OR (m1.id NOT IN ('{$this->task->id}') AND {0}.deleted = 0) AND m2.id = '1'", 0, 0, 3000, $this->tasksSelectFields, 'tasks_assigned_user', array('id' => $this->task->id), 1, $this->noSoapErrorArray)); }