3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php';
28 class WebTest_Import_ActivityTest
extends ImportCiviSeleniumTestCase
{
30 protected function setUp() {
34 function testActivityImport() {
36 $this->webtestLogin();
38 // Get sample import data.
39 list($headers, $rows) = $this->_activityCSVData();
41 'mapper[0][0]' => 'target_contact_id',
42 'mapper[1][0]' => 'activity_label',
43 'mapper[2][0]' => 'activity_subject',
44 'mapper[3][0]' => 'activity_date_time',
46 $this->importCSVComponent('Activity', $headers, $rows, NULL, NULL, $fieldMapper);
49 function _activityCSVData() {
51 $firstName1 = substr(sha1(rand()), 0, 7);
52 $email1 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
53 $this->webtestAddContact($firstName1, 'Anderson', $email1);
54 $id1 = $this->urlArg('cid');
56 $firstName2 = substr(sha1(rand()), 0, 7);
57 $email2 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
58 $this->webtestAddContact($firstName2, 'Anderson', $email2);
59 $id2 = $this->urlArg('cid');
62 'target_contact_id' => 'Contact ID',
63 'activity_type_label' => 'Activity Type Label',
64 'subject' => 'Subject',
65 'activity_date' => 'Activity Date',
66 'activity_status_id' => 'Activity Status Id',
67 'duration' => 'Duration',
68 'location' => 'Location',
73 'target_contact_id' => $id1,
74 'activity_type_label' => 'Meeting',
75 'subject' => 'Test Meeting',
76 'activity_date' => '2009-10-01',
77 'activity_status_id' => 'Completed',
82 'target_contact_id' => $id2,
83 'activity_type_label' => 'Phone Call',
84 'subject' => 'Test Phone Call',
85 'activity_date' => '2010-10-15',
86 'activity_status_id' => 'Completed',
92 return array($headers, $rows);