/** * Function to update relationship type * * @param array $params Associative array of property name/value pairs to update the relationship type. * * @return array Array with relationship type information * * @access public * * @todo Requires some work */ function civicrm_relationship_type_update($params) { return civicrm_relationship_type_add($params); }
function relationshipTypeCreate(&$params) { require_once 'api/v2/Relationship.php'; $result = civicrm_relationship_type_add($params); if (civicrm_error($params)) { throw new Exception('Could not create relationship type'); } return $result['id']; }
/** * check with invalid relationshipType Id */ function testRelationshipTypeAddInvalidId() { $relTypeParams = array('id' => 'invalid', 'name_a_b' => 'Relation 1 for delete', 'name_b_a' => 'Relation 2 for delete', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Organization'); $result =& civicrm_relationship_type_add($relTypeParams); $this->assertEquals($result['is_error'], 1); $this->assertEquals($result['error_message'], 'Invalid value for relationship type ID'); }
/** * create relationship type */ function testRelationshipTypeCreate() { $relTypeParams = array('name_a_b' => 'Relation 1 for relationship type create', 'name_b_a' => 'Relation 2 for relationship type create', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Organization', 'is_reserved' => 1, 'is_active' => 1); $relationshiptype =& civicrm_relationship_type_add($relTypeParams); $this->assertNotNull($relationshiptype['id']); // assertDBState compares expected values in $result to actual values in the DB $this->assertDBState('CRM_Contact_DAO_RelationshipType', $relationshiptype['id'], $relTypeParams); }