+ /**
+ * Helper function for getting sample contact properties
+ *
+ * @param enum contact type: Individual, Organization
+ * @param int sequence number for the values of this type
+ *
+ * @return array properties of sample contact (ie. $params for API call)
+ */
+ function sampleContact($contact_type, $seq = 0) {
+ $samples = array(
+ 'Individual' => array(
+ // The number of values in each list need to be coprime numbers to not have duplicates
+ 'first_name' => array('Anthony', 'Joe', 'Terrence', 'Lucie', 'Albert', 'Bill', 'Kim'),
+ 'middle_name' => array('J.', 'M.', 'P', 'L.', 'K.', 'A.', 'B.', 'C.', 'D', 'E.', 'Z.'),
+ 'last_name' => array('Anderson', 'Miller', 'Smith', 'Collins', 'Peterson'),
+ ),
+ 'Organization' => array(
+ 'organization_name' => array('Unit Test Organization', 'Acme', 'Roberts and Sons', 'Cryo Space Labs', 'Sharper Pens'),
+ ),
+ 'Household' => array(
+ 'household_name' => array('Unit Test household'),
+ ),
+ );
+ $params = array('contact_type' => $contact_type);
+ foreach ($samples[$contact_type] as $key => $values) {
+ $params[$key] = $values[$seq % sizeof($values)];
+ }
+ if ($contact_type == 'Individual' ) {
+ $params['email'] = strtolower(
+ $params['first_name'] . '_' . $params['last_name'] . '@civicrm.org'
+ );
+ $params['prefix_id'] = 3;
+ $params['suffix_id'] = 3;
+ }
+ return $params;
+ }
+