Merge pull request #5536 from totten/4.5-httpclient
[civicrm-core.git] / tests / phpunit / api / v3 / RelationshipTest.php
index e8702ddc6f2bb7d457c4197a128b6713a410cfdf..d7d7eacd4e5f4e9ed7d2d0ba302afd6c8b655314 100644 (file)
@@ -1,29 +1,29 @@
 <?php
 /**
- +--------------------------------------------------------------------+
- | 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        |
- +--------------------------------------------------------------------+
-*/
+--------------------------------------------------------------------+
| CiviCRM version 4.6                                                |
+--------------------------------------------------------------------+
* | Copyright CiviCRM LLC (c) 2004-2015                                |
+--------------------------------------------------------------------+
| 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';
 
@@ -35,7 +35,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
   protected $_cId_a;
   /**
-   * Second individual
+   * Second individual.
    * @var integer
    */
   protected $_cId_a_2;
@@ -49,10 +49,14 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
 
   protected $_entity;
 
-  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';
@@ -78,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);
@@ -90,16 +94,16 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   ///////////////// civicrm_relationship_create methods
 
   /**
-   * Check with empty array
+   * Check with empty array.
    */
-  function testRelationshipCreateEmpty() {
+  public function testRelationshipCreateEmpty() {
     $this->callAPIFailure('relationship', 'create', array());
   }
 
   /**
-   * Check if required fields are not passed
+   * 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'),
@@ -110,9 +114,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with incorrect required fields
+   * Check with incorrect required fields.
    */
-  function testRelationshipCreateWithIncorrectData() {
+  public function testRelationshipCreateWithIncorrectData() {
 
     $params = array(
       'contact_id_a' => $this->_cId_a,
@@ -143,9 +147,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check relationship creation with invalid Relationship
+   * 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,
@@ -170,14 +174,15 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check relationship already exists
+   * 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);
@@ -196,9 +201,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check relationship already exists
+   * Check relationship already exists.
    */
-  function testRelationshipCreateUpdateAlreadyExists() {
+  public function testRelationshipCreateUpdateAlreadyExists() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -223,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,
@@ -247,11 +252,10 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
 
-
   /**
-   * Check relationship creation
+   * Check relationship creation.
    */
-  function testRelationshipCreate() {
+  public function testRelationshipCreate() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -281,26 +285,31 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $params['id'] = $result['id'];
     $this->callAPISuccess('relationship', 'delete', $params);
   }
+
   /**
-   * Ensure disabling works
+   * 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
+   * Check relationship creation.
    */
-  function testRelationshipCreateEmptyEndDate() {
+  public function testRelationshipCreateEmptyEndDate() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -325,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;
       }
@@ -336,9 +345,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check relationship creation with custom data
+   * Check relationship creation with custom data.
    */
-  function testRelationshipCreateWithCustomData() {
+  public function testRelationshipCreateWithCustomData() {
     $customGroup = $this->createCustomGroup();
     $this->_ids = $this->createCustomField();
     //few custom Values for comparing
@@ -376,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;
@@ -396,7 +405,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * @return mixed
    */
-  function createCustomGroup() {
+  public function createCustomGroup() {
     $params = array(
       'title' => 'Custom Group',
       'extends' => array('Relationship'),
@@ -413,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,
@@ -427,7 +436,6 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'is_active' => 1,
     );
 
-
     $result = $this->callAPISuccess('CustomField', 'create', $params);
 
     $customField = NULL;
@@ -504,17 +512,17 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   ///////////////// civicrm_relationship_delete methods
 
   /**
-   * Check with empty array
+   * 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');
   }
 
   /**
-   * Check if required fields are not passed
+   * Check if required fields are not passed.
    */
-  function testRelationshipDeleteWithoutRequired() {
+  public function testRelationshipDeleteWithoutRequired() {
     $params = array(
       'start_date' => '2008-12-20',
       'end_date' => '2009-12-20',
@@ -525,9 +533,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with incorrect required fields
+   * Check with incorrect required fields.
    */
-  function testRelationshipDeleteWithIncorrectData() {
+  public function testRelationshipDeleteWithIncorrectData() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -541,9 +549,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check relationship creation
+   * Check relationship creation.
    */
-  function testRelationshipDelete() {
+  public function testRelationshipDelete() {
     $params = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -565,21 +573,21 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   ///////////////// civicrm_relationship_update methods
 
   /**
-   * Check with empty array
+   * 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');
   }
 
   /**
-   * Check if required fields are not passed
+   * Check if required fields are not passed.
    */
 
   /**
-   * Check relationship update
+   * Check relationship update.
    */
-  function testRelationshipCreateDuplicate() {
+  public function testRelationshipCreateDuplicate() {
     $relParams = array(
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
@@ -619,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,
@@ -654,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,
@@ -673,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,
@@ -685,9 +693,9 @@ 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";
+    $description = "Demonstrates is_current filter.";
     $subfile = 'filterIsCurrent';
     //no relationship has been created
     $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__, __FILE__, $description, $subfile);
@@ -695,106 +703,108 @@ 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
+
+  /**
+   * 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";
+    $description = "Demonstrates use of IN filter.";
     $subfile = 'INRelationshipType';
 
     $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals($result['count'], 2);
     $this->AssertEquals(array($rel2['id'], $rel3['id']), array_keys($result['values']));
 
-    $description = "demonstrates use of NOT IN filter";
+    $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);
     $this->AssertEquals(array($rel1['id'], $rel4['id']), array_keys($result['values']));
 
-    $description = "demonstrates use of BETWEEN filter";
+    $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);
     $this->AssertEquals(array($rel2['id'], $rel3['id'], $rel4['id']), array_keys($result['values']));
 
-    $description = "demonstrates use of Not BETWEEN filter";
+    $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
+   * Check with invalid relationshipType Id.
    */
-  function testRelationshipTypeAddInvalidId() {
+  public function testRelationshipTypeAddInvalidId() {
     $relTypeParams = array(
       'id' => 'invalid',
       'name_a_b' => 'Relation 1 for delete',
@@ -807,9 +817,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with valid data with contact_b
+   * 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,
@@ -835,9 +845,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with valid data with relationshipTypes
+   * 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,
@@ -869,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,
@@ -891,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,
@@ -915,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!
@@ -925,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(
@@ -953,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!
@@ -963,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(
@@ -985,13 +1000,15 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   /**
+   * Test relationship get by membership type.
+   *
    * Checks that passing in 'contact_id_b' + a relationship type
    * will filter by relationship type for contact b
    *
    * 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();
 
@@ -1007,14 +1024,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
@@ -1022,7 +1041,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(
@@ -1043,8 +1063,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!
@@ -1059,14 +1079,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
@@ -1074,7 +1096,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(
@@ -1092,9 +1115,10 @@ 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));
   }
+
 }