Skip to content

Commit

Permalink
Merge pull request civicrm#10839 from MegaphoneJon/CRM-21049
Browse files Browse the repository at this point in the history
CRM-21049 - Allow creating relationship types with no contact type specified
  • Loading branch information
colemanw authored Aug 22, 2017
2 parents 1f8eeb3 + e14ba58 commit 8af1022
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
2 changes: 0 additions & 2 deletions api/v3/RelationshipType.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ function civicrm_api3_relationship_type_create($params) {
* Array of parameters determined by getfields.
*/
function _civicrm_api3_relationship_type_create_spec(&$params) {
$params['contact_type_a']['api.required'] = 1;
$params['contact_type_b']['api.required'] = 1;
$params['name_a_b']['api.required'] = 1;
$params['name_b_a']['api.required'] = 1;
$params['is_active']['api.default'] = 1;
Expand Down
15 changes: 1 addition & 14 deletions tests/phpunit/api/v3/RelationshipTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,6 @@ public function testRelationshipTypeCreateWithoutName() {
);
}

/**
* Check with no contact type.
*/
public function testRelationshipTypeCreateWithoutContactType() {
$relTypeParams = array(
'name_a_b' => 'Relation 1 without contact type',
'name_b_a' => 'Relation 2 without contact type',
);
$result = $this->callAPIFailure('relationship_type', 'create', $relTypeParams,
'Mandatory key(s) missing from params array: contact_type_a, contact_type_b'
);
}

/**
* Create relationship type.
*/
Expand Down Expand Up @@ -190,7 +177,7 @@ public function testRelationshipTypeDelete() {
public function testRelationshipTypeUpdateEmpty() {
$params = array();
$result = $this->callAPIFailure('relationship_type', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: name_a_b, name_b_a, contact_type_a, contact_type_b');
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: name_a_b, name_b_a');
}

/**
Expand Down

0 comments on commit 8af1022

Please sign in to comment.