<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
*/
require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Import_MultipleRelationshipTest
+ */
class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase {
protected function setUp() {
parent::setUp();
}
- /*
- * Test Multiple Relationship import for Individuals.
- */
- function testMultipleRelationshipImport() {
+ /**
+ * Test Multiple Relationship import for Individuals.
+ */
+ public function testMultipleRelationshipImport() {
$this->webtestLogin();
// Get sample import data.
$this->importContacts($headers, $rows, 'Individual', 'Skip', $fieldMapper);
}
- /*
+ /**
* Helper function to provide data for multiple relationship import
* for Individuals.
-
+ *
+ * @return array
*/
- function _individualRelationshipCSVData() {
+ public function _individualRelationshipCSVData() {
$headers = array(
'first_name' => 'First Name',
'state' => 'State',
'country' => 'Country',
'contact_relationships' =>
- array(
- '4_a_b' => array('organization_name' => 'Organization Name',
- 'organization_email' => 'Organization Email',
- 'organization_add' => 'Organization Street Address',
- 'organization_city' => 'Organization City',
- 'organization_state' => 'Organization State',
- 'organization_country' => 'Organization Country',
- ),
- '7_a_b' => array(
- 'household_name' => 'Household Name',
- 'household_email' => 'Household Name',
- 'household_add' => 'Household Street Address',
- 'household_city' => 'Household City',
- 'household_state' => 'Household State',
- 'household_country' => 'Household Country',
- ),
- '2_a_b' => array(
- 'spouse_f_name' => 'Spouse First Name',
- 'spouse_l_name' => 'Spouse Last Name',
- 'spouse_email' => 'Spouse Email',
- 'spouse_add' => 'Spouse Street Address',
- 'spouse_city' => 'Spouse City',
- 'spouse_state' => 'Spouse State',
- 'spouse_country' => 'Spouse Country',
+ array(
+ '4_a_b' => array(
+ 'organization_name' => 'Organization Name',
+ 'organization_email' => 'Organization Email',
+ 'organization_add' => 'Organization Street Address',
+ 'organization_city' => 'Organization City',
+ 'organization_state' => 'Organization State',
+ 'organization_country' => 'Organization Country',
+ ),
+ '7_a_b' => array(
+ 'household_name' => 'Household Name',
+ 'household_email' => 'Household Name',
+ 'household_add' => 'Household Street Address',
+ 'household_city' => 'Household City',
+ 'household_state' => 'Household State',
+ 'household_country' => 'Household Country',
+ ),
+ '2_a_b' => array(
+ 'spouse_f_name' => 'Spouse First Name',
+ 'spouse_l_name' => 'Spouse Last Name',
+ 'spouse_email' => 'Spouse Email',
+ 'spouse_add' => 'Spouse Street Address',
+ 'spouse_city' => 'Spouse City',
+ 'spouse_state' => 'Spouse State',
+ 'spouse_country' => 'Spouse Country',
+ ),
),
- ),
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
'contact_relationships' =>
- array('4_a_b' => array('organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
- 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org',
- 'organization_add' => 'Org Street Address',
- 'organization_city' => 'Org City',
- 'organization_state' => 'NY',
- 'organization_country' => 'United States',
+ array(
+ '4_a_b' => array(
+ 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
+ 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org',
+ 'organization_add' => 'Org Street Address',
+ 'organization_city' => 'Org City',
+ 'organization_state' => 'NY',
+ 'organization_country' => 'United States',
+ ),
+ '7_a_b' => array(
+ 'household_name' => 'House ' . substr(sha1(rand()), 0, 7),
+ 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org',
+ 'household_add' => 'House Street Address',
+ 'household_city' => 'House City',
+ 'household_state' => 'NY',
+ 'household_country' => 'United States',
+ ),
+ '2_a_b' => array(
+ 'spouse_f_name' => substr(sha1(rand()), 0, 7),
+ 'spouse_l_name' => substr(sha1(rand()), 0, 7),
+ 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org',
+ 'spouse_add' => 'Spouse Street Address',
+ 'spouse_city' => 'Spouse City',
+ 'spouse_state' => 'NY',
+ 'spouse_country' => 'United States',
+ ),
),
- '7_a_b' => array('household_name' => 'House ' . substr(sha1(rand()), 0, 7),
- 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org',
- 'household_add' => 'House Street Address',
- 'household_city' => 'House City',
- 'household_state' => 'NY',
- 'household_country' => 'United States',
- ),
- '2_a_b' => array('spouse_f_name' => substr(sha1(rand()), 0, 7),
- 'spouse_l_name' => substr(sha1(rand()), 0, 7),
- 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org',
- 'spouse_add' => 'Spouse Street Address',
- 'spouse_city' => 'Spouse City',
- 'spouse_state' => 'NY',
- 'spouse_country' => 'United States',
- ),
- ),
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
'contact_relationships' =>
- array('4_a_b' => array('organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
- 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org',
- 'organization_add' => 'Org Street Address',
- 'organization_city' => 'Org City',
- 'organization_state' => 'NY',
- 'organization_country' => 'United States',
+ array(
+ '4_a_b' => array(
+ 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
+ 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org',
+ 'organization_add' => 'Org Street Address',
+ 'organization_city' => 'Org City',
+ 'organization_state' => 'NY',
+ 'organization_country' => 'United States',
+ ),
+ '7_a_b' => array(
+ 'household_name' => 'House ' . substr(sha1(rand()), 0, 7),
+ 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org',
+ 'household_add' => 'House Street Address',
+ 'household_city' => 'House City',
+ 'household_state' => 'NY',
+ 'household_country' => 'United States',
+ ),
+ '2_a_b' => array(
+ 'spouse_f_name' => substr(sha1(rand()), 0, 7),
+ 'spouse_l_name' => substr(sha1(rand()), 0, 7),
+ 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org',
+ 'spouse_add' => 'Spouse Street Address',
+ 'spouse_city' => 'Spouse City',
+ 'spouse_state' => 'NY',
+ 'spouse_country' => 'United States',
+ ),
),
- '7_a_b' => array('household_name' => 'House ' . substr(sha1(rand()), 0, 7),
- 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org',
- 'household_add' => 'House Street Address',
- 'household_city' => 'House City',
- 'household_state' => 'NY',
- 'household_country' => 'United States',
- ),
- '2_a_b' => array('spouse_f_name' => substr(sha1(rand()), 0, 7),
- 'spouse_l_name' => substr(sha1(rand()), 0, 7),
- 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org',
- 'spouse_add' => 'Spouse Street Address',
- 'spouse_city' => 'Spouse City',
- 'spouse_state' => 'NY',
- 'spouse_country' => 'United States',
- ),
- ),
),
);
- // for Employee of relationship
+ // for Employee of relationship
$fieldMapper = array(
'mapper[10][0]' => '5_a_b',
'mapper[10][1]' => 'organization_name',
return array($headers, $rows, $fieldMapper);
}
}
-