webtestLogin(); // Get sample import data. list($headers, $rows) = $this->_activityCSVData(); $fieldMapper = array( 'mapper[0][0]' => 'target_contact_id', 'mapper[1][0]' => 'activity_label', 'mapper[2][0]' => 'activity_subject', 'mapper[3][0]' => 'activity_date_time', ); $this->importCSVComponent('Activity', $headers, $rows, NULL, NULL, $fieldMapper); } /** * @return array */ public function _activityCSVData() { $firstName1 = substr(sha1(rand()), 0, 7); $email1 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com'; $this->webtestAddContact($firstName1, 'Anderson', $email1); $id1 = $this->urlArg('cid'); $firstName2 = substr(sha1(rand()), 0, 7); $email2 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com'; $this->webtestAddContact($firstName2, 'Anderson', $email2); $id2 = $this->urlArg('cid'); $headers = array( 'target_contact_id' => 'Contact ID', 'activity_type_label' => 'Activity Type Label', 'subject' => 'Subject', 'activity_date' => 'Activity Date', 'activity_status_id' => 'Activity Status Id', 'duration' => 'Duration', 'location' => 'Location', ); $rows = array( array( 'target_contact_id' => $id1, 'activity_type_label' => 'Meeting', 'subject' => 'Test Meeting', 'activity_date' => '2009-10-01', 'activity_status_id' => 'Completed', 'duration' => '20', 'location' => 'UK', ), array( 'target_contact_id' => $id2, 'activity_type_label' => 'Phone Call', 'subject' => 'Test Phone Call', 'activity_date' => '2010-10-15', 'activity_status_id' => 'Completed', 'duration' => '20', 'location' => 'USA', ), ); return array($headers, $rows); } }