<?php
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
-| Copyright CiviCRM LLC (c) 2004-2014 |
+| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
protected $_relTypeID;
protected $_apiversion = 3;
- 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',
///////////////// civicrm_relationship_type_add methods
/**
- * Check with no name
+ * Check with no name.
*/
- function testRelationshipTypeCreateWithoutName() {
+ public function testRelationshipTypeCreateWithoutName() {
$relTypeParams = array(
'contact_type_a' => 'Individual',
'contact_type_b' => 'Organization',
}
/**
- * Check with no contact type
+ * 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
+ * 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
+ * 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
+ * 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
+ * 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
+ * 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);
///////////////// civicrm_relationship_type_update
/**
- * Check with empty array
+ * 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
+ * Check with no contact type.
*/
- function testRelationshipTypeUpdateWithoutContactType() {
+ public function testRelationshipTypeUpdateWithoutContactType() {
// create sample relationship type.
$this->_relTypeID = $this->_relationshipTypeCreate();
}
/**
- * Check with all parameters
+ * Check with all parameters.
*/
- function testRelationshipTypeUpdate() {
+ public function testRelationshipTypeUpdate() {
// create sample relationship type.
$this->_relTypeID = $this->_relationshipTypeCreate();
///////////////// civicrm_relationship_types_get methods
/**
- * Check with empty array
+ * 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);
}
-}
+}