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 and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviUnitTestCase.php';
31 * Class contains api test cases for "civicrm_relationship"
34 class api_v3_RelationshipTest
extends CiviUnitTestCase
{
35 protected $_apiversion = 3;
38 protected $_cId_b2;// second org
39 protected $_relTypeID;
40 protected $_ids = array();
41 protected $_customGroupId = NULL;
42 protected $_customFieldId = NULL;
44 public $_eNoticeCompliant = TRUE;
48 'name' => 'Relationship Create',
49 'description' => 'Test all Relationship Create API methods.',
50 'group' => 'CiviCRM API Tests',
56 $this->_cId_a
= $this->individualCreate(NULL);
57 $this->_cId_b
= $this->organizationCreate();
58 $this->_cId_b2
= $this->organizationCreate(array('organization_name' => ' Org 2'));
59 $this->_entity
= 'relationship';
60 //Create a relationship type
61 $relTypeParams = array(
62 'name_a_b' => 'Relation 1 for delete',
63 'name_b_a' => 'Relation 2 for delete',
64 'description' => 'Testing relationship type',
65 'contact_type_a' => 'Individual',
66 'contact_type_b' => 'Organization',
71 $this->_relTypeID
= $this->relationshipTypeCreate($relTypeParams);
72 $this->_params
= array(
73 'contact_id_a' => $this->_cId_a
,
74 'contact_id_b' => $this->_cId_b
,
75 'relationship_type_id' => $this->_relTypeID
,
76 'start_date' => '2008-12-20',
83 $this->quickCleanup(array('civicrm_relationship'), TRUE);
84 $this->relationshipTypeDelete($this->_relTypeID
);
85 $this->contactDelete($this->_cId_a
);
86 $this->contactDelete($this->_cId_b
);
89 ///////////////// civicrm_relationship_create methods
92 * check with empty array
94 function testRelationshipCreateEmpty() {
95 $this->callAPIFailure('relationship', 'create', array());
99 * check if required fields are not passed
101 function testRelationshipCreateWithoutRequired() {
103 'start_date' => array('d' => '10', 'M' => '1', 'Y' => '2008'),
104 'end_date' => array('d' => '10', 'M' => '1', 'Y' => '2009'),
108 $this->callAPIFailure('relationship', 'create', $params);
112 * check with incorrect required fields
114 function testRelationshipCreateWithIncorrectData() {
117 'contact_id_a' => $this->_cId_a
,
118 'contact_id_b' => $this->_cId_b
,
119 'relationship_type_id' => 'Breaking Relationship',
122 $this->callAPIFailure('relationship', 'create', $params);
124 //contact id is not an integer
126 'contact_id_a' => 'invalid',
127 'contact_id_b' => $this->_cId_b
,
128 'relationship_type_id' => $this->_relTypeID
,
129 'start_date' => array('d' => '10', 'M' => '1', 'Y' => '2008'),
132 $this->callAPIFailure('relationship', 'create', $params);
134 //contact id does not exists
135 $params['contact_id_a'] = 999;
136 $this->callAPIFailure('relationship', 'create', $params);
139 $params['contact_id_a'] = $this->_cId_a
;
140 $params['start_date'] = array('d' => '1', 'M' => '1');
141 $this->callAPIFailure('relationship', 'create', $params);
145 * check relationship creation with invalid Relationship
147 function testRelationshipCreatInvalidRelationship() {
148 // both the contact of type Individual
150 'contact_id_a' => $this->_cId_a
,
151 'contact_id_b' => $this->_cId_a
,
152 'relationship_type_id' => $this->_relTypeID
,
153 'start_date' => '2008-01-10',
157 $this->callAPIFailure('relationship', 'create', $params);
159 // both the contact of type Organization
161 'contact_id_a' => $this->_cId_b
,
162 'contact_id_b' => $this->_cId_b
,
163 'relationship_type_id' => $this->_relTypeID
,
164 'start_date' => '2008-01-10',
168 $this->callAPIFailure('relationship', 'create', $params);
172 * check relationship already exists
174 function testRelationshipCreateAlreadyExists() {
176 'contact_id_a' => $this->_cId_a
,
177 'contact_id_b' => $this->_cId_b
,
178 'relationship_type_id' => $this->_relTypeID
,
179 'start_date' => '2008-12-20', 'end_date' => NULL,
182 $relationship = $this->callAPISuccess('relationship', 'create', $params);
185 'contact_id_a' => $this->_cId_a
,
186 'contact_id_b' => $this->_cId_b
,
187 'relationship_type_id' => $this->_relTypeID
,
188 'start_date' => '2008-12-20',
191 $result = $this->callAPIFailure('relationship', 'create', $params, 'Relationship already exists');
193 $params['id'] = $relationship['id'];
194 $result = $this->callAPISuccess('relationship', 'delete', $params);
198 * check relationship already exists
200 function testRelationshipCreateUpdateAlreadyExists() {
202 'contact_id_a' => $this->_cId_a
,
203 'contact_id_b' => $this->_cId_b
,
204 'relationship_type_id' => $this->_relTypeID
,
205 'start_date' => '2008-12-20',
210 $relationship = $this->callAPISuccess('relationship', 'create', $params);
212 'id' => $relationship['id'],
216 $result = $this->callAPISuccess('relationship', 'create', $params);
217 $this->assertAPISuccess($result, 'in line ' . __LINE__
);
218 $result = $this->callAPISuccess('relationship', 'get', $params);
219 $params['id'] = $relationship['id'];
220 $result = $this->callAPISuccess('relationship', 'delete', $params);
224 * checkupdate doesn't reset stuff badly - CRM-11789
226 function testRelationshipCreateUpdateDoesntMangle() {
228 'contact_id_a' => $this->_cId_a
,
229 'contact_id_b' => $this->_cId_b
,
230 'relationship_type_id' => $this->_relTypeID
,
231 'start_date' => '2008-12-20',
233 'is_permission_a_b' => 1,
234 'description' => 'my desc',
236 $relationship = $this->callAPISuccess('relationship', 'create', $params);
238 $updateparams = array(
239 'id' => $relationship['id'],
240 'relationship_type_id' => $this->_relTypeID
,
242 $result = $this->callAPISuccess('relationship', 'create', $updateparams);
244 //make sure the orig params didn't get changed
245 $this->getAndCheck($params, $relationship['id'], 'relationship');
252 * check relationship creation
254 function testRelationshipCreate() {
256 'contact_id_a' => $this->_cId_a
,
257 'contact_id_b' => $this->_cId_b
,
258 'relationship_type_id' => $this->_relTypeID
,
259 'start_date' => '2010-10-30',
260 'end_date' => '2010-12-30',
265 $result = $this->callAPIAndDocument('relationship', 'create', $params, __FUNCTION__
, __FILE__
);
266 $this->assertNotNull($result['id'], 'in line ' . __LINE__
);
267 $relationParams = array(
268 'id' => $result['id'],
271 // assertDBState compares expected values in $result to actual values in the DB
272 $this->assertDBState('CRM_Contact_DAO_Relationship', $result['id'], $relationParams);
273 $result = $this->callAPISuccess('relationship', 'get', array('id' => $result['id']));
274 $values = $result['values'][$result['id']];
275 foreach ($params as $key => $value) {
276 if ($key == 'note') {
279 $this->assertEquals($value, $values[$key], $key . " doesn't match " . print_r($values, TRUE) . 'in line' . __LINE__
);
281 $params['id'] = $result['id'];
282 $this->callAPISuccess('relationship', 'delete', $params);
286 * check relationship creation
288 function testRelationshipCreateEmptyEndDate() {
290 'contact_id_a' => $this->_cId_a
,
291 'contact_id_b' => $this->_cId_b
,
292 'relationship_type_id' => $this->_relTypeID
,
293 'start_date' => '2010-10-30',
299 $result = $this->callAPISuccess('relationship', 'create', $params);
300 $this->assertNotNull($result['id'], 'in line ' . __LINE__
);
301 $relationParams = array(
302 'id' => $result['id'],
305 // assertDBState compares expected values in $result to actual values in the DB
306 $this->assertDBState('CRM_Contact_DAO_Relationship', $result['id'], $relationParams);
307 $result = $this->callAPISuccess('relationship', 'get', array('id' => $result['id']));
308 $values = $result['values'][$result['id']];
309 foreach ($params as $key => $value) {
310 if ($key == 'note') {
313 if($key == 'end_date'){
314 $this->assertTrue(empty($values[$key]));
317 $this->assertEquals($value, $values[$key], $key . " doesn't match " . print_r($values, TRUE) . 'in line' . __LINE__
);
319 $params['id'] = $result['id'];
320 $this->callAPISuccess('relationship', 'delete', $params);
324 * check relationship creation with custom data
326 function testRelationshipCreateWithCustomData() {
327 $customGroup = $this->createCustomGroup();
328 $this->_ids
= $this->createCustomField();
329 //few custom Values for comparing
330 $custom_params = array(
331 "custom_{$this->_ids[0]}" => 'Hello! this is custom data for relationship',
332 "custom_{$this->_ids[1]}" => 'Y',
333 "custom_{$this->_ids[2]}" => '2009-07-11 00:00:00',
334 "custom_{$this->_ids[3]}" => 'http://example.com',
338 'contact_id_a' => $this->_cId_a
,
339 'contact_id_b' => $this->_cId_b
,
340 'relationship_type_id' => $this->_relTypeID
,
341 'start_date' => '2008-12-20',
344 $params = array_merge($params, $custom_params);
345 $result = $this->callAPISuccess('relationship', 'create', $params);
347 $relationParams = array(
348 'id' => $result['id'],
350 // assertDBState compares expected values in $result to actual values in the DB
351 $this->assertDBState('CRM_Contact_DAO_Relationship', $result['id'], $relationParams);
353 $params['id'] = $result['id'];
354 $result = $this->callAPISuccess('relationship', 'delete', $params);
355 $this->relationshipTypeDelete($this->_relTypeID
);
359 * check with complete array + custom field
360 * Note that the test is written on purpose without any
361 * variables specific to participant so it can be replicated into other entities
362 * and / or moved to the automated test suite
364 function testGetWithCustom() {
365 $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__
, __FILE__
);
367 $params = $this->_params
;
368 $params['custom_' . $ids['custom_field_id']] = "custom string";
370 $result = $this->callAPISuccess($this->_entity
, 'create', $params);
371 $this->assertEquals($result['id'], $result['values'][$result['id']]['id']);
373 $getParams = array('id' => $result['id']);
374 $check = $this->callAPIAndDocument($this->_entity
, 'get', $getParams, __FUNCTION__
, __FILE__
);
375 $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__
);
377 $this->customFieldDelete($ids['custom_field_id']);
378 $this->customGroupDelete($ids['custom_group_id']);
381 function createCustomGroup() {
383 'title' => 'Custom Group',
384 'extends' => array('Relationship'),
390 $customGroup = $this->callAPISuccess('custom_group', 'create', $params);
391 $this->_customGroupId
= $customGroup['id'];
392 return $customGroup['id'];
395 function createCustomField() {
398 'custom_group_id' => $this->_customGroupId
,
399 'label' => 'Enter text about relationship',
400 'html_type' => 'Text',
401 'data_type' => 'String',
402 'default_value' => 'xyz',
405 'is_searchable' => 0,
410 $result = $this->callAPISuccess('CustomField', 'create', $params);
413 $ids[] = $customField['result']['customFieldId'];
415 $optionValue[] = array(
421 $optionValue[] = array(
427 $optionValue[] = array(
435 'label' => 'Pick Color',
436 'html_type' => 'Select',
437 'data_type' => 'String',
440 'is_searchable' => 0,
442 'option_values' => $optionValue,
443 'custom_group_id' => $this->_customGroupId
,
446 $customField = $this->callAPISuccess('custom_field', 'create', $params);
447 $ids[] = $customField['id'];
450 'custom_group_id' => $this->_customGroupId
,
451 'name' => 'test_date',
452 'label' => 'test_date',
453 'html_type' => 'Select Date',
454 'data_type' => 'Date',
455 'default_value' => '20090711',
458 'is_searchable' => 0,
462 $customField = $this->callAPISuccess('custom_field', 'create', $params);
464 $ids[] = $customField['id'];
466 'custom_group_id' => $this->_customGroupId
,
467 'name' => 'test_link',
468 'label' => 'test_link',
469 'html_type' => 'Link',
470 'data_type' => 'Link',
471 'default_value' => 'http://civicrm.org',
474 'is_searchable' => 0,
478 $customField = $this->callAPISuccess('custom_field', 'create', $params);
479 $ids[] = $customField['id'];
483 ///////////////// civicrm_relationship_delete methods
486 * check with empty array
488 function testRelationshipDeleteEmpty() {
490 $result = $this->callAPIFailure('relationship', 'delete', $params, 'Mandatory key(s) missing from params array: id');
494 * check if required fields are not passed
496 function testRelationshipDeleteWithoutRequired() {
498 'start_date' => '2008-12-20',
499 'end_date' => '2009-12-20',
503 $result = $this->callAPIFailure('relationship', 'delete', $params);
504 $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: id');
508 * check with incorrect required fields
510 function testRelationshipDeleteWithIncorrectData() {
512 'contact_id_a' => $this->_cId_a
,
513 'contact_id_b' => $this->_cId_b
,
514 'relationship_type_id' => 'Breaking Relationship',
517 $result = $this->callAPIFailure('relationship', 'delete', $params, 'Mandatory key(s) missing from params array: id', 'in line ' . __LINE__
);
519 $params['id'] = "Invalid";
520 $result = $this->callAPIFailure('relationship', 'delete', $params, 'Invalid value for relationship ID', 'in line ' . __LINE__
);
524 * check relationship creation
526 function testRelationshipDelete() {
528 'contact_id_a' => $this->_cId_a
,
529 'contact_id_b' => $this->_cId_b
,
530 'relationship_type_id' => $this->_relTypeID
,
531 'start_date' => '2008-12-20',
535 $result = $this->callAPISuccess('relationship', 'create', $params);
537 //Delete relationship
539 $params['id'] = $result['id'];
541 $result = $this->callAPIAndDocument('relationship', 'delete', $params, __FUNCTION__
, __FILE__
);
542 $this->relationshipTypeDelete($this->_relTypeID
);
545 ///////////////// civicrm_relationship_update methods
548 * check with empty array
550 function testRelationshipUpdateEmpty() {
551 $result = $this->callAPIFailure('relationship', 'create', array());
552 $this->assertEquals('Mandatory key(s) missing from params array: contact_id_a, contact_id_b, relationship_type_id', $result['error_message'], 'In line ' . __LINE__
);
556 * check if required fields are not passed
560 * check relationship update
562 function testRelationshipCreateDuplicate() {
564 'contact_id_a' => $this->_cId_a
,
565 'contact_id_b' => $this->_cId_b
,
566 'relationship_type_id' => $this->_relTypeID
,
567 'start_date' => '20081214',
568 'end_date' => '20091214',
572 $result = $this->callAPISuccess('relationship', 'create', $relParams);
574 $this->assertNotNull($result['id'], 'In line ' . __LINE__
);
575 $this->_relationID
= $result['id'];
578 'contact_id_a' => $this->_cId_a
,
579 'contact_id_b' => $this->_cId_b
,
580 'relationship_type_id' => $this->_relTypeID
,
581 'start_date' => '20081214',
582 'end_date' => '20091214',
586 $result = $this->callAPIFailure('relationship', 'create', $params, 'Relationship already exists', 'In line ' . __LINE__
);
588 //delete created relationship
590 'id' => $this->_relationID
,
593 $result = $this->callAPISuccess('relationship', 'delete', $params);
595 //delete created relationship type
596 $this->relationshipTypeDelete($this->_relTypeID
);
600 * check with valid params array.
602 function testRelationshipsGet() {
604 'contact_id_a' => $this->_cId_a
,
605 'contact_id_b' => $this->_cId_b
,
606 'relationship_type_id' => $this->_relTypeID
,
607 'start_date' => '2011-01-01',
608 'end_date' => '2013-01-01',
612 $result = $this->callAPISuccess('relationship', 'create', $relParams);
616 'contact_id' => $this->_cId_b
,
618 $result = $this->callAPISuccess('relationship', 'get', $params);
619 $this->assertEquals($result['count'], 1, 'in line ' . __LINE__
);
621 'contact_id_a' => $this->_cId_a
,
623 $result = $this->callAPISuccess('relationship', 'get', $params);
624 $this->assertEquals($result['count'], 1, 'in line ' . __LINE__
);
625 // contact_id_a is wrong so should be no matches
627 'contact_id_a' => $this->_cId_b
,
629 $result = $this->callAPISuccess('relationship', 'get', $params);
630 $this->assertEquals($result['count'], 0, 'in line ' . __LINE__
);
634 * check with valid params array.
635 * (The get function will behave differently without 'contact_id' passed
637 function testRelationshipsGetGeneric() {
639 'contact_id_a' => $this->_cId_a
,
640 'contact_id_b' => $this->_cId_b
,
641 'relationship_type_id' => $this->_relTypeID
,
642 'start_date' => '2011-01-01',
643 'end_date' => '2013-01-01',
647 $result = $this->callAPISuccess('relationship', 'create', $relParams);
651 'contact_id_b' => $this->_cId_b
,
653 $result = $this->callAPISuccess('relationship', 'get', $params);
656 function testGetIsCurrent() {
658 'contact_id_a' => $this->_cId_a
,
659 'contact_id_b' => $this->_cId_b2
,
660 'relationship_type_id' => $this->_relTypeID
,
661 'start_date' => '2008-12-20',
664 $rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params);
665 $rel1 = $this->callAPISuccess('relationship', 'create', $this->_params
);
668 'filters' => array('is_current' => 1)
670 $description = "demonstrates is_current filter";
671 $subfile = 'filterIsCurrent';
672 //no relationship has been created
673 $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__
, __FILE__
, $description, $subfile);
674 $this->assertEquals($result['count'], 1);
675 $this->AssertEquals($rel1['id'], $result['id']);
677 // now try not started
678 $rel2Params['is_active'] =1;
679 $rel2Params['start_date'] ='tomorrow';
680 $rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params);
681 $result = $this->callAPISuccess('relationship', 'get', $getParams);
682 $this->assertEquals($result['count'], 1);
683 $this->AssertEquals($rel1['id'], $result['id']);
686 $rel2Params['is_active'] =1;
687 $rel2Params['start_date'] ='last week';
688 $rel2Params['end_date'] ='yesterday';
689 $rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params);
692 * Test using various operators
694 function testGetTypeOperators() {
695 $relTypeParams = array(
696 'name_a_b' => 'Relation 3 for delete',
697 'name_b_a' => 'Relation 6 for delete',
698 'description' => 'Testing relationship type 2',
699 'contact_type_a' => 'Individual',
700 'contact_type_b' => 'Organization',
704 $relationType2 = $this->relationshipTypeCreate($relTypeParams);
705 $relTypeParams = array(
706 'name_a_b' => 'Relation 8 for delete',
707 'name_b_a' => 'Relation 9 for delete',
708 'description' => 'Testing relationship type 7',
709 'contact_type_a' => 'Individual',
710 'contact_type_b' => 'Organization',
714 $relationType3 = $this->relationshipTypeCreate($relTypeParams);
716 $relTypeParams = array(
717 'name_a_b' => 'Relation 6 for delete',
718 'name_b_a' => 'Relation 88for delete',
719 'description' => 'Testing relationship type 00',
720 'contact_type_a' => 'Individual',
721 'contact_type_b' => 'Organization',
725 $relationType4 = $this->relationshipTypeCreate($relTypeParams);
727 $rel1 = $this->callAPISuccess('relationship', 'create', $this->_params
);
728 $rel2 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params
,
729 array('relationship_type_id' => $relationType2,)));
730 $rel3 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params
,
731 array('relationship_type_id' => $relationType3,)));
732 $rel4 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params
,
733 array('relationship_type_id' => $relationType4,)));
736 'relationship_type_id' => array('IN' => array($relationType2, $relationType3))
739 $description = "demonstrates use of IN filter";
740 $subfile = 'INRelationshipType';
742 $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__
, __FILE__
, $description, $subfile);
743 $this->assertEquals($result['count'], 2);
744 $this->AssertEquals(array($rel2['id'], $rel3['id']), array_keys($result['values']));
746 $description = "demonstrates use of NOT IN filter";
747 $subfile = 'NotInRelationshipType';
749 'relationship_type_id' => array('NOT IN' => array($relationType2, $relationType3))
751 $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__
, __FILE__
, $description, $subfile);
752 $this->assertEquals($result['count'], 2);
753 $this->AssertEquals(array($rel1['id'], $rel4['id']), array_keys($result['values']));
755 $description = "demonstrates use of BETWEEN filter";
756 $subfile = 'BetweenRelationshipType';
758 'relationship_type_id' => array('BETWEEN' => array($relationType2, $relationType4))
760 $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__
, __FILE__
, $description, $subfile);
761 $this->assertEquals($result['count'], 3);
762 $this->AssertEquals(array($rel2['id'], $rel3['id'], $rel4['id']), array_keys($result['values']));
764 $description = "demonstrates use of Not BETWEEN filter";
765 $subfile = 'NotBetweenRelationshipType';
767 'relationship_type_id' => array('NOT BETWEEN' => array($relationType2, $relationType4))
769 $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__
, __FILE__
, $description, $subfile);
770 $this->assertEquals($result['count'], 1);
771 $this->AssertEquals(array($rel1['id'],), array_keys($result['values']));
775 * check with invalid relationshipType Id
777 function testRelationshipTypeAddInvalidId() {
778 $relTypeParams = array(
780 'name_a_b' => 'Relation 1 for delete',
781 'name_b_a' => 'Relation 2 for delete',
782 'contact_type_a' => 'Individual',
783 'contact_type_b' => 'Organization',
785 $result = $this->callAPIFailure('relationship_type', 'create', $relTypeParams);
786 $this->assertEquals('id is not a valid integer', $result['error_message'], 'in line ' . __LINE__
);
790 * check with valid data with contact_b
792 function testGetRelationshipWithContactB() {
794 'contact_id_a' => $this->_cId_a
,
795 'contact_id_b' => $this->_cId_b
,
796 'relationship_type_id' => $this->_relTypeID
,
797 'start_date' => '2011-01-01',
798 'end_date' => '2013-01-01',
802 $relationship = $this->callAPISuccess('relationship', 'create', $relParams);
805 'contact_id' => $this->_cId_a
,
808 $result = $this->callAPISuccess('relationship', 'get', $contacts);
809 $this->assertGreaterThan(0, $result['count'], 'in line ' . __LINE__
);
811 'id' => $relationship['id'],
813 $result = $this->callAPISuccess('relationship', 'delete', $params);
814 $this->relationshipTypeDelete($this->_relTypeID
);
818 * check with valid data with relationshipTypes
820 function testGetRelationshipWithRelTypes() {
822 'contact_id_a' => $this->_cId_a
,
823 'contact_id_b' => $this->_cId_b
,
824 'relationship_type_id' => $this->_relTypeID
,
825 'start_date' => '2011-01-01',
826 'end_date' => '2013-01-01',
830 $relationship = $this->callAPISuccess('relationship', 'create', $relParams);
833 'contact_id' => $this->_cId_a
,
835 $result = $this->callAPISuccess('relationship', 'get', $contact_a);
838 'id' => $relationship['id'],
840 $result = $this->callAPISuccess('relationship', 'delete', $params);
841 $this->relationshipTypeDelete($this->_relTypeID
);