Skip to content

Commit

Permalink
Merge pull request civicrm#15738 from agileware/CIVICRM-1354
Browse files Browse the repository at this point in the history
Fix the relationship direction in testSingleMembershipForTwoRelationships
  • Loading branch information
eileenmcnaughton authored Nov 6, 2019
2 parents bdde6b8 + 1c7c69c commit fe5aa2e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/phpunit/CRM/Contact/BAO/RelationshipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ public function testSingleMembershipForTwoRelationships() {
'period_type' => 'rolling',
'name' => 'Inherited Membership',
'relationship_type_id' => [$orgToPersonTypeId1, $orgToPersonTypeId2],
'relationship_direction' => ['b_a', 'a_b'],
'relationship_direction' => ['b_a', 'b_a'],
]);
$membershipType = $this->callAPISuccessGetSingle('MembershipType', ['id' => $membershipType['id']]);
// Check the metadata worked....
$this->assertEquals([$orgToPersonTypeId1, $orgToPersonTypeId2], $membershipType['relationship_type_id']);
$this->assertEquals(['b_a', 'a_b'], $membershipType['relationship_direction']);
$this->assertEquals(['b_a', 'b_a'], $membershipType['relationship_direction']);

$this->callAPISuccess('Membership', 'create', [
'membership_type_id' => $membershipType['id'],
Expand All @@ -252,11 +252,13 @@ public function testSingleMembershipForTwoRelationships() {
'contact_id_b' => $organisationID,
'relationship_type_id' => $orgToPersonTypeId1,
]);
$this->callAPISuccessGetCount('Membership', ['contact_id' => $individualID], 1);
$relationshipTwo = $this->callAPISuccess('Relationship', 'create', [
'contact_id_a' => $individualID,
'contact_id_b' => $organisationID,
'relationship_type_id' => $orgToPersonTypeId2,
]);
$this->callAPISuccessGetCount('Membership', ['contact_id' => $individualID], 1);

$inheritedMembership = $this->callAPISuccessGetSingle('Membership', ['contact_id' => $individualID]);
$this->assertEquals('2019-08-19', $inheritedMembership['start_date']);
Expand Down

0 comments on commit fe5aa2e

Please sign in to comment.