Merge pull request #4931 from davecivicrm/INFRA-132
[civicrm-core.git] / tests / phpunit / api / v3 / RelationshipTest.php
index b01a1ca4ef47901c73a80f42780af8a47ce38aae..dbd8f607d5cced29942b63f0012ebf5ef2b49603 100644 (file)
@@ -1,29 +1,29 @@
 <?php
 /**
- +--------------------------------------------------------------------+
| CiviCRM version 4.5                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | 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                                |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM.                                    |
|                                                                    |
| CiviCRM is free software; you can copy, modify, and distribute it  |
| under the terms of the GNU Affero General Public License           |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
|                                                                    |
| CiviCRM is distributed in the hope that it will be useful, but     |
| WITHOUT ANY WARRANTY; without even the implied warranty of         |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
| See the GNU Affero General Public License for more details.        |
|                                                                    |
| You should have received a copy of the GNU Affero General Public   |
| License and the CiviCRM Licensing Exception along                  |
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| 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';
 
@@ -49,21 +49,14 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
 
   protected $_entity;
 
-  /**
-   * @return array
-   */
-  function get_info() {
-    return array(
-      'name' => 'Relationship Create',
-      'description' => 'Test all Relationship Create API methods.',
-      'group' => 'CiviCRM API Tests',
-    );
-  }
-
-  function setUp() {
+  public function setUp() {
     parent::setUp();
     $this->_cId_a = $this->individualCreate();
-    $this->_cId_a_2 = $this->individualCreate(array('last_name' => 'c2', 'email' => 'c@w.com', 'contact_type' => 'Individual'));
+    $this->_cId_a_2 = $this->individualCreate(array(
+      'last_name' => 'c2',
+      'email' => 'c@w.com',
+      'contact_type' => 'Individual',
+    ));
     $this->_cId_b = $this->organizationCreate();
     $this->_cId_b2 = $this->organizationCreate(array('organization_name' => ' Org 2'));
     $this->_entity = 'relationship';
@@ -89,7 +82,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
 
   }
 
-  function tearDown() {
+  public function tearDown() {
     $this->contactDelete($this->_cId_a);
     $this->contactDelete($this->_cId_a_2);
     $this->contactDelete($this->_cId_b);
@@ -103,14 +96,14 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with empty array
    */
-  function testRelationshipCreateEmpty() {
+  public function testRelationshipCreateEmpty() {
     $this->callAPIFailure('relationship', 'create', array());
   }
 
   /**
    * Check if required fields are not passed
    */
-  function testRelationshipCreateWithoutRequired() {
+  public function testRelationshipCreateWithoutRequired() {
     $params = array(
       'start_date' => array('d' => '10', 'M' => '1', 'Y' => '2008'),
       'end_date' => array('d' => '10', 'M' => '1', 'Y' => '2009'),
@@ -123,7 +116,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with incorrect required fields
    */
-  function testRelationshipCreateWithIncorrectData() {
+  public function testRelationshipCreateWithIncorrectData() {
 
     $params = array(
       'contact_id_a' => $this->_cId_a,
@@ -156,7 +149,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check relationship creation with invalid Relationship
    */
-  function testRelationshipCreatInvalidRelationship() {
+  public function testRelationshipCreatInvalidRelationship() {
     // both the contact of type Individual
     $params = array(
       'contact_id_a' => $this->_cId_a,
@@ -183,12 +176,13 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check relationship already exists
    */
-  function testRelationshipCreateAlreadyExists() {
+  public function testRelationshipCreateAlreadyExists() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
       'relationship_type_id' => $this->_relTypeID,
-      'start_date' => '2008-12-20', 'end_date' => NULL,
+      'start_date' => '2008-12-20',
+      'end_date' => NULL,
       'is_active' => 1,
     );
     $relationship = $this->callAPISuccess('relationship', 'create', $params);
@@ -209,7 +203,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check relationship already exists
    */
-  function testRelationshipCreateUpdateAlreadyExists() {
+  public function testRelationshipCreateUpdateAlreadyExists() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -234,7 +228,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Checkupdate doesn't reset stuff badly - CRM-11789
    */
-  function testRelationshipCreateUpdateDoesntMangle() {
+  public function testRelationshipCreateUpdateDoesntMangle() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -258,11 +252,10 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
 
-
   /**
    * Check relationship creation
    */
-  function testRelationshipCreate() {
+  public function testRelationshipCreate() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -292,26 +285,31 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $params['id'] = $result['id'];
     $this->callAPISuccess('relationship', 'delete', $params);
   }
+
   /**
    * Ensure disabling works
    */
-  function testRelationshipUpdate() {
+  public function testRelationshipUpdate() {
     $result = $this->callAPISuccess('relationship', 'create', $this->_params);
     $relID = $result['id'];
     $result = $this->callAPISuccess('relationship', 'create', array('id' => $relID, 'description' => 'blah'));
     $this->assertEquals($relID, $result['id']);
+
     $this->assertEquals('blah', $result['values'][$result['id']]['description']);
+
     $result = $this->callAPISuccess('relationship', 'create', array('id' => $relID, 'is_permission_b_a' => 1));
     $this->assertEquals(1, $result['values'][$result['id']]['is_permission_b_a']);
     $result = $this->callAPISuccess('relationship', 'create', array('id' => $result['id'], 'is_active' => 0));
+    $result = $this->callAPISuccess('relationship', 'get', array('id' => $result['id']));
     $this->assertEquals(0, $result['values'][$result['id']]['is_active']);
     $this->assertEquals('blah', $result['values'][$result['id']]['description']);
     $this->assertEquals(1, $result['values'][$result['id']]['is_permission_b_a']);
   }
+
   /**
    * Check relationship creation
    */
-  function testRelationshipCreateEmptyEndDate() {
+  public function testRelationshipCreateEmptyEndDate() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -336,7 +334,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       if ($key == 'note') {
         continue;
       }
-      if($key == 'end_date'){
+      if ($key == 'end_date') {
         $this->assertTrue(empty($values[$key]));
         continue;
       }
@@ -349,7 +347,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check relationship creation with custom data
    */
-  function testRelationshipCreateWithCustomData() {
+  public function testRelationshipCreateWithCustomData() {
     $customGroup = $this->createCustomGroup();
     $this->_ids = $this->createCustomField();
     //few custom Values for comparing
@@ -387,7 +385,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * variables specific to participant so it can be replicated into other entities
    * and / or moved to the automated test suite
    */
-  function testGetWithCustom() {
+  public function testGetWithCustom() {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
 
     $params = $this->_params;
@@ -407,7 +405,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * @return mixed
    */
-  function createCustomGroup() {
+  public function createCustomGroup() {
     $params = array(
       'title' => 'Custom Group',
       'extends' => array('Relationship'),
@@ -424,7 +422,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * @return array
    */
-  function createCustomField() {
+  public function createCustomField() {
     $ids = array();
     $params = array(
       'custom_group_id' => $this->_customGroupId,
@@ -438,7 +436,6 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'is_active' => 1,
     );
 
-
     $result = $this->callAPISuccess('CustomField', 'create', $params);
 
     $customField = NULL;
@@ -517,7 +514,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with empty array
    */
-  function testRelationshipDeleteEmpty() {
+  public function testRelationshipDeleteEmpty() {
     $params = array();
     $result = $this->callAPIFailure('relationship', 'delete', $params, 'Mandatory key(s) missing from params array: id');
   }
@@ -525,7 +522,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check if required fields are not passed
    */
-  function testRelationshipDeleteWithoutRequired() {
+  public function testRelationshipDeleteWithoutRequired() {
     $params = array(
       'start_date' => '2008-12-20',
       'end_date' => '2009-12-20',
@@ -538,7 +535,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with incorrect required fields
    */
-  function testRelationshipDeleteWithIncorrectData() {
+  public function testRelationshipDeleteWithIncorrectData() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -554,7 +551,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check relationship creation
    */
-  function testRelationshipDelete() {
+  public function testRelationshipDelete() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -578,7 +575,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with empty array
    */
-  function testRelationshipUpdateEmpty() {
+  public function testRelationshipUpdateEmpty() {
     $result = $this->callAPIFailure('relationship', 'create', array(),
       'Mandatory key(s) missing from params array: contact_id_a, contact_id_b, relationship_type_id');
   }
@@ -590,7 +587,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check relationship update
    */
-  function testRelationshipCreateDuplicate() {
+  public function testRelationshipCreateDuplicate() {
     $relParams = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -630,7 +627,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with valid params array.
    */
-  function testRelationshipsGet() {
+  public function testRelationshipsGet() {
     $relParams = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -665,7 +662,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * Check with valid params array.
    * (The get function will behave differently without 'contact_id' passed
    */
-  function testRelationshipsGetGeneric() {
+  public function testRelationshipsGetGeneric() {
     $relParams = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -684,8 +681,8 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('relationship', 'get', $params);
   }
 
-  function testGetIsCurrent() {
-    $rel2Params =array(
+  public function testGetIsCurrent() {
+    $rel2Params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b2,
       'relationship_type_id' => $this->_relTypeID,
@@ -696,7 +693,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $rel1 = $this->callAPISuccess('relationship', 'create', $this->_params);
 
     $getParams = array(
-      'filters' => array('is_current' => 1)
+      'filters' => array('is_current' => 1),
     );
     $description = "demonstrates is_current filter";
     $subfile = 'filterIsCurrent';
@@ -706,65 +703,66 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $this->AssertEquals($rel1['id'], $result['id']);
 
     // now try not started
-    $rel2Params['is_active'] =1;
-    $rel2Params['start_date'] ='tomorrow';
+    $rel2Params['is_active'] = 1;
+    $rel2Params['start_date'] = 'tomorrow';
     $rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params);
     $result = $this->callAPISuccess('relationship', 'get', $getParams);
     $this->assertEquals($result['count'], 1);
     $this->AssertEquals($rel1['id'], $result['id']);
 
     // now try finished
-    $rel2Params['is_active'] =1;
-    $rel2Params['start_date'] ='last week';
-    $rel2Params['end_date'] ='yesterday';
+    $rel2Params['is_active'] = 1;
+    $rel2Params['start_date'] = 'last week';
+    $rel2Params['end_date'] = 'yesterday';
     $rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params);
   }
+
   /*
    * Test using various operators
    */
-  function testGetTypeOperators() {
+  public function testGetTypeOperators() {
     $relTypeParams = array(
-        'name_a_b' => 'Relation 3 for delete',
-        'name_b_a' => 'Relation 6 for delete',
-        'description' => 'Testing relationship type 2',
-        'contact_type_a' => 'Individual',
-        'contact_type_b' => 'Organization',
-        'is_reserved' => 1,
-        'is_active' => 1,
+      'name_a_b' => 'Relation 3 for delete',
+      'name_b_a' => 'Relation 6 for delete',
+      'description' => 'Testing relationship type 2',
+      'contact_type_a' => 'Individual',
+      'contact_type_b' => 'Organization',
+      'is_reserved' => 1,
+      'is_active' => 1,
     );
     $relationType2 = $this->relationshipTypeCreate($relTypeParams);
     $relTypeParams = array(
-        'name_a_b' => 'Relation 8 for delete',
-        'name_b_a' => 'Relation 9 for delete',
-        'description' => 'Testing relationship type 7',
-        'contact_type_a' => 'Individual',
-        'contact_type_b' => 'Organization',
-        'is_reserved' => 1,
-        'is_active' => 1,
+      'name_a_b' => 'Relation 8 for delete',
+      'name_b_a' => 'Relation 9 for delete',
+      'description' => 'Testing relationship type 7',
+      'contact_type_a' => 'Individual',
+      'contact_type_b' => 'Organization',
+      'is_reserved' => 1,
+      'is_active' => 1,
     );
     $relationType3 = $this->relationshipTypeCreate($relTypeParams);
 
     $relTypeParams = array(
-        'name_a_b' => 'Relation 6 for delete',
-        'name_b_a' => 'Relation 88for delete',
-        'description' => 'Testing relationship type 00',
-        'contact_type_a' => 'Individual',
-        'contact_type_b' => 'Organization',
-        'is_reserved' => 1,
-        'is_active' => 1,
+      'name_a_b' => 'Relation 6 for delete',
+      'name_b_a' => 'Relation 88for delete',
+      'description' => 'Testing relationship type 00',
+      'contact_type_a' => 'Individual',
+      'contact_type_b' => 'Organization',
+      'is_reserved' => 1,
+      'is_active' => 1,
     );
     $relationType4 = $this->relationshipTypeCreate($relTypeParams);
 
     $rel1 = $this->callAPISuccess('relationship', 'create', $this->_params);
     $rel2 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params,
-      array('relationship_type_id' => $relationType2,)));
+      array('relationship_type_id' => $relationType2)));
     $rel3 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params,
-        array('relationship_type_id' => $relationType3,)));
+      array('relationship_type_id' => $relationType3)));
     $rel4 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params,
-        array('relationship_type_id' => $relationType4,)));
+      array('relationship_type_id' => $relationType4)));
 
     $getParams = array(
-      'relationship_type_id' => array('IN' => array($relationType2, $relationType3))
+      'relationship_type_id' => array('IN' => array($relationType2, $relationType3)),
     );
 
     $description = "demonstrates use of IN filter";
@@ -777,7 +775,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $description = "demonstrates use of NOT IN filter";
     $subfile = 'NotInRelationshipType';
     $getParams = array(
-        'relationship_type_id' => array('NOT IN' => array($relationType2, $relationType3))
+      'relationship_type_id' => array('NOT IN' => array($relationType2, $relationType3)),
     );
     $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals($result['count'], 2);
@@ -786,7 +784,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $description = "demonstrates use of BETWEEN filter";
     $subfile = 'BetweenRelationshipType';
     $getParams = array(
-        'relationship_type_id' => array('BETWEEN' => array($relationType2, $relationType4))
+      'relationship_type_id' => array('BETWEEN' => array($relationType2, $relationType4)),
     );
     $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals($result['count'], 3);
@@ -795,17 +793,18 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $description = "demonstrates use of Not BETWEEN filter";
     $subfile = 'NotBetweenRelationshipType';
     $getParams = array(
-        'relationship_type_id' => array('NOT BETWEEN' => array($relationType2, $relationType4))
+      'relationship_type_id' => array('NOT BETWEEN' => array($relationType2, $relationType4)),
     );
     $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals($result['count'], 1);
-    $this->AssertEquals(array($rel1['id'],), array_keys($result['values']));
+    $this->AssertEquals(array($rel1['id']), array_keys($result['values']));
 
   }
+
   /**
    * Check with invalid relationshipType Id
    */
-  function testRelationshipTypeAddInvalidId() {
+  public function testRelationshipTypeAddInvalidId() {
     $relTypeParams = array(
       'id' => 'invalid',
       'name_a_b' => 'Relation 1 for delete',
@@ -820,7 +819,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with valid data with contact_b
    */
-  function testGetRelationshipWithContactB() {
+  public function testGetRelationshipWithContactB() {
     $relParams = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -848,7 +847,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check with valid data with relationshipTypes
    */
-  function testGetRelationshipWithRelTypes() {
+  public function testGetRelationshipWithRelTypes() {
     $relParams = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -880,7 +879,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * We should get 1 result without or with correct relationship type id & 0 with
    * an incorrect one
    */
-  function testGetRelationshipByTypeReciprocal() {
+  public function testGetRelationshipByTypeReciprocal() {
     $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
     $result = $this->callAPISuccess($this->_entity, 'get', array(
       'contact_id' => $this->_cId_a,
@@ -902,11 +901,12 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * We should get 1 result without or with correct relationship type id & 0 with
    * an incorrect one
    */
-  function testGetRelationshipByTypeDAO() {
-    $this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE,)  + $this->_params);
+  public function testGetRelationshipByTypeDAO() {
+    $this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE) + $this->_params);
     $result = $this->callAPISuccess($this->_entity, 'getcount', array(
-      'contact_id_a' => $this->_cId_a,),
-    1);
+        'contact_id_a' => $this->_cId_a,
+      ),
+      1);
     $result = $this->callAPISuccess($this->_entity, 'get', array(
       'contact_id_a' => $this->_cId_a,
       'relationship_type_id' => $this->_relTypeID,
@@ -926,7 +926,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * We should get 1 result without or with correct relationship type id & 0 with
    * an incorrect one
    */
-  function testGetRelationshipByTypeArrayDAO() {
+  public function testGetRelationshipByTypeArrayDAO() {
     $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
     $relType2 = 5; // lets just assume built in ones aren't being messed with!
@@ -936,14 +936,16 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
-        'contact_id_b' => $this->_cId_b2))
+        'contact_id_b' => $this->_cId_b2,
+      ))
     );
 
     //relationshp 3
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
-        'contact_id_b' => $org3))
+        'contact_id_b' => $org3,
+      ))
     );
 
     $result = $this->callAPISuccess($this->_entity, 'get', array(
@@ -964,7 +966,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * We should get 1 result without or with correct relationship type id & 0 with
    * an incorrect one
    */
-  function testGetRelationshipByTypeArrayReciprocal() {
+  public function testGetRelationshipByTypeArrayReciprocal() {
     $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
     $relType2 = 5; // lets just assume built in ones aren't being messed with!
@@ -974,14 +976,16 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
-        'contact_id_b' => $this->_cId_b2))
+        'contact_id_b' => $this->_cId_b2,
+      ))
     );
 
     //relationshp 3
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
-        'contact_id_b' => $org3))
+        'contact_id_b' => $org3,
+      ))
     );
 
     $result = $this->callAPISuccess($this->_entity, 'get', array(
@@ -1002,7 +1006,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * We should get 1 result without or with correct relationship type id & 0 with
    * an incorrect one
    */
-  function testGetRelationshipByMembershipTypeDAO() {
+  public function testGetRelationshipByMembershipTypeDAO() {
     $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
 
@@ -1018,14 +1022,16 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
-        'contact_id_b' => $this->_cId_b2))
+        'contact_id_b' => $this->_cId_b2,
+      ))
     );
 
     //relationshp 3
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
-        'contact_id_b' => $org3))
+        'contact_id_b' => $org3,
+      ))
     );
 
     //relationshp 4 with reveral
@@ -1033,7 +1039,8 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       array_merge($this->_params, array(
         'relationship_type_id' => $relType1,
         'contact_id_a' => $this->_cId_a,
-        'contact_id_b' => $this->_cId_a_2))
+        'contact_id_b' => $this->_cId_a_2,
+      ))
     );
 
     $result = $this->callAPISuccess($this->_entity, 'get', array(
@@ -1054,8 +1061,8 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * We should get 1 result without or with correct relationship type id & 0 with
    * an incorrect one
    */
-  function testGetRelationshipByMembershipTypeReciprocal() {
-      $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
+  public function testGetRelationshipByMembershipTypeReciprocal() {
+    $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
 
     $relType2 = 5; // lets just assume built in ones aren't being messed with!
@@ -1070,14 +1077,16 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
-        'contact_id_b' => $this->_cId_b2))
+        'contact_id_b' => $this->_cId_b2,
+      ))
     );
 
     //relationshp 3
     $this->callAPISuccess($this->_entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
-        'contact_id_b' => $org3))
+        'contact_id_b' => $org3,
+      ))
     );
 
     //relationshp 4 with reveral
@@ -1085,7 +1094,8 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       array_merge($this->_params, array(
         'relationship_type_id' => $relType1,
         'contact_id_a' => $this->_cId_a,
-        'contact_id_b' => $this->_cId_a_2))
+        'contact_id_b' => $this->_cId_a_2,
+      ))
     );
 
     $result = $this->callAPISuccess($this->_entity, 'get', array(
@@ -1103,7 +1113,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Check for enotices on enable & disable as reported in CRM-14350
    */
-  function testSetActive() {
+  public function testSetActive() {
     $relationship = $this->callAPISuccess($this->_entity, 'create', $this->_params);
     $this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 0));
     $this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 1));