public static function disableEnableRelationship($id, $action, $params = array(), $ids = array(), $active = FALSE) {
$relationship = self::clearCurrentEmployer($id, $action);
- if (CRM_Core_Permission::access('CiviMember')) {
+ if ($id) {
// create $params array which is required to delete memberships
// of the related contacts.
if (empty($params)) {
$result = $this->callAPISuccess('membership', 'get', $params);
$this->assertEquals(1, $result['count']);
+ // Delete relationship and assert membership is not inherited
+ $this->callAPISuccess('relationship', 'delete', array('id' => $relationship1['id']));
+ $result = $this->callAPISuccess('membership', 'get', $params);
+ $this->assertEquals(0, $result['count']);
+
// Tear down - reverse of creation to be safe
$this->contactDelete($memberContactId[2]);
$this->contactDelete($memberContactId[1]);