<?php
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
protected $_relTypeID;
protected $_apiversion = 3;
- /**
- * @return array
- */
- function get_info() {
- return array(
- 'name' => 'RelationshipType Create',
- 'description' => 'Test all RelationshipType Create API methods.',
- 'group' => 'CiviCRM API Tests',
- );
- }
-
- function setUp() {
+ public function setUp() {
parent::setUp();
- $this->_cId_a = $this->individualCreate();
- $this->_cId_b = $this->organizationCreate();
+ $this->_cId_a = $this->individualCreate();
+ $this->_cId_b = $this->organizationCreate();
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_contact',
/**
* Check with no name
*/
- function testRelationshipTypeCreateWithoutName() {
+ public function testRelationshipTypeCreateWithoutName() {
$relTypeParams = array(
'contact_type_a' => 'Individual',
'contact_type_b' => 'Organization',
/**
* Check with no contact type
*/
- function testRelationshipTypeCreateWithoutContactType() {
+ public function testRelationshipTypeCreateWithoutContactType() {
$relTypeParams = array(
'name_a_b' => 'Relation 1 without contact type',
'name_b_a' => 'Relation 2 without contact type',
/**
* Create relationship type
*/
- function testRelationshipTypeCreate() {
+ public function testRelationshipTypeCreate() {
$params = array(
'name_a_b' => 'Relation 1 for relationship type create',
'name_b_a' => 'Relation 2 for relationship type create',
/**
* Test using example code
*/
- function testRelationshipTypeCreateExample() {
+ public function testRelationshipTypeCreateExample() {
require_once 'api/v3/examples/RelationshipType/Create.php';
$result = relationship_type_create_example();
$expectedResult = relationship_type_create_expectedresult();
/**
* Check if required fields are not passed
*/
- function testRelationshipTypeDeleteWithoutRequired() {
+ public function testRelationshipTypeDeleteWithoutRequired() {
$params = array(
'name_b_a' => 'Relation 2 delete without required',
'contact_type_b' => 'Individual',
/**
* Check with incorrect required fields
*/
- function testRelationshipTypeDeleteWithIncorrectData() {
+ public function testRelationshipTypeDeleteWithIncorrectData() {
$params = array(
'id' => 'abcd',
'name_b_a' => 'Relation 2 delete with incorrect',
/**
* Check relationship type delete
*/
- function testRelationshipTypeDelete() {
+ public function testRelationshipTypeDelete() {
$id = $this->_relationshipTypeCreate();
// create sample relationship type.
$params = array(
- 'id' => $id,
+ 'id' => $id,
);
$result = $this->callAPIAndDocument('relationship_type', 'delete', $params, __FUNCTION__, __FILE__);
$this->assertAPIDeleted('relationship_type', $id);
/**
* Check with empty array
*/
- function testRelationshipTypeUpdateEmpty() {
+ 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');
/**
* Check with no contact type
*/
- function testRelationshipTypeUpdateWithoutContactType() {
+ public function testRelationshipTypeUpdateWithoutContactType() {
// create sample relationship type.
$this->_relTypeID = $this->_relationshipTypeCreate();
/**
* Check with all parameters
*/
- function testRelationshipTypeUpdate() {
+ public function testRelationshipTypeUpdate() {
// create sample relationship type.
$this->_relTypeID = $this->_relationshipTypeCreate();
/**
* Check with empty array
*/
- function testRelationshipTypesGetEmptyParams() {
+ public function testRelationshipTypesGetEmptyParams() {
$firstRelTypeParams = array(
'name_a_b' => 'Relation 27 for create',
'name_b_a' => 'Relation 28 for create',
/**
* Check with params Not Array.
*/
- function testRelationshipTypesGetParamsNotArray() {
+ public function testRelationshipTypesGetParamsNotArray() {
$results = $this->callAPIFailure('relationship_type', 'get', 'string');
}
/**
* Check with valid params array.
*/
- function testRelationshipTypesGet() {
+ public function testRelationshipTypesGet() {
$firstRelTypeParams = array(
'name_a_b' => 'Relation 30 for create',
'name_b_a' => 'Relation 31 for create',
/**
* Create relationship type.
+ * @param null $params
+ * @return mixed
*/
- function _relationshipTypeCreate($params = NULL) {
+ public function _relationshipTypeCreate($params = NULL) {
if (!is_array($params) || empty($params)) {
$params = array(
'name_a_b' => 'Relation 1 for create',
return $this->relationshipTypeCreate($params);
}
}
-