3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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';
30 * Class WebTest_Import_ActivityTest
32 class WebTest_Import_ActivityTest
extends ImportCiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testActivityImport() {
40 $this->webtestLogin();
42 // Get sample import data.
43 list($headers, $rows) = $this->_activityCSVData();
45 'mapper[0][0]' => 'target_contact_id',
46 'mapper[1][0]' => 'activity_label',
47 'mapper[2][0]' => 'activity_subject',
48 'mapper[3][0]' => 'activity_date_time',
50 $this->importCSVComponent('Activity', $headers, $rows, NULL, NULL, $fieldMapper);
56 public function _activityCSVData() {
58 $firstName1 = substr(sha1(rand()), 0, 7);
59 $email1 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
60 $this->webtestAddContact($firstName1, 'Anderson', $email1);
61 $id1 = $this->urlArg('cid');
63 $firstName2 = substr(sha1(rand()), 0, 7);
64 $email2 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
65 $this->webtestAddContact($firstName2, 'Anderson', $email2);
66 $id2 = $this->urlArg('cid');
69 'target_contact_id' => 'Contact ID',
70 'activity_type_label' => 'Activity Type Label',
71 'subject' => 'Subject',
72 'activity_date' => 'Activity Date',
73 'activity_status_id' => 'Activity Status Id',
74 'duration' => 'Duration',
75 'location' => 'Location',
80 'target_contact_id' => $id1,
81 'activity_type_label' => 'Meeting',
82 'subject' => 'Test Meeting',
83 'activity_date' => '2009-10-01',
84 'activity_status_id' => 'Completed',
89 'target_contact_id' => $id2,
90 'activity_type_label' => 'Phone Call',
91 'subject' => 'Test Phone Call',
92 'activity_date' => '2010-10-15',
93 'activity_status_id' => 'Completed',
99 return array($headers, $rows);