Coding standards cleanup sprint.
[civicrm-core.git] / tests / phpunit / api / v3 / ContactTest.php
index 1b6758dd5518dda00c682e50231dd6935b6b31a6..49904ca9410a2bcab535ef9c8059420e1935d57c 100644 (file)
@@ -4,12 +4,12 @@
  *
  *  (PHP 5)
  *
- *   @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- *   @copyright Copyright CiviCRM LLC (C) 2009
- *   @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html
  *              GNU Affero General Public License version 3
- *   @version   $Id: ContactTest.php 31254 2010-12-15 10:09:29Z eileen $
- *   @package   CiviCRM
+ * @version   $Id: ContactTest.php 31254 2010-12-15 10:09:29Z eileen $
+ * @package   CiviCRM
  *
  *   This file is part of CiviCRM
  *
@@ -37,10 +37,9 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  *  Test APIv3 civicrm_contact* functions
  *
- *  @package CiviCRM_APIv3
- *  @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
  */
-
 class api_v3_ContactTest extends CiviUnitTestCase {
   public $DBResetRequired = FALSE;
   protected $_apiversion;
@@ -48,7 +47,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   protected $_params;
 
   protected $_contactID;
-  protected $_financialTypeId =1;
+  protected $_financialTypeId = 1;
 
   /**
    *  Test setup for every test
@@ -68,7 +67,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     );
   }
 
-  function tearDown() {
+  public function tearDown() {
     // truncate a few tables
     $tablesToTruncate = array(
       'civicrm_contact',
@@ -90,7 +89,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create individual contact with only
    *  first and last names succeeds
    */
-  function testAddCreateIndividual() {
+  public function testAddCreateIndividual() {
     $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_contact');
     $params = array(
       'first_name' => 'abc1',
@@ -102,7 +101,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertTrue(is_numeric($contact['id']), "In line " . __LINE__);
     $this->assertTrue($contact['id'] > 0, "In line " . __LINE__);
     $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_contact');
-    $this->assertEquals($oldCount+1, $newCount);
+    $this->assertEquals($oldCount + 1, $newCount);
 
     $this->assertDBState('CRM_Contact_DAO_Contact',
       $contact['id'],
@@ -115,13 +114,13 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *
    *  Verify that sub-types are created successfully and not deleted by subsequent updates
    */
-  function testIndividualSubType() {
+  public function testIndividualSubType() {
     $params = array(
       'first_name' => 'test abc',
       'contact_type' => 'Individual',
       'last_name' => 'test xyz',
       'contact_sub_type' => array('Student', 'Staff'),
-     );
+    );
     $contact = $this->callAPISuccess('contact', 'create', $params);
     $cid = $contact['id'];
 
@@ -140,26 +139,26 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Verify that attempt to create contact with empty params fails
    */
-  function testCreateEmptyContact() {
+  public function testCreateEmptyContact() {
     $this->callAPIFailure('contact', 'create', array());
   }
 
   /**
    *  Verify that attempt to create contact with bad contact type fails
    */
-  function testCreateBadTypeContact() {
+  public function testCreateBadTypeContact() {
     $params = array(
       'email' => 'man1@yahoo.com',
       'contact_type' => 'Does not Exist',
     );
-    $this->callAPIFailure('contact', 'create', $params,"'Does not Exist' is not a valid option for field contact_type");
+    $this->callAPIFailure('contact', 'create', $params, "'Does not Exist' is not a valid option for field contact_type");
   }
 
   /**
    *  Verify that attempt to create individual contact with required
    *  fields missing fails
    */
-  function testCreateBadRequiredFieldsIndividual() {
+  public function testCreateBadRequiredFieldsIndividual() {
     $params = array(
       'middle_name' => 'This field is not required',
       'contact_type' => 'Individual',
@@ -171,7 +170,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create household contact with required
    *  fields missing fails
    */
-  function testCreateBadRequiredFieldsHousehold() {
+  public function testCreateBadRequiredFieldsHousehold() {
     $params = array(
       'middle_name' => 'This field is not required',
       'contact_type' => 'Household',
@@ -183,7 +182,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create organization contact with
    *  required fields missing fails
    */
-  function testCreateBadRequiredFieldsOrganization() {
+  public function testCreateBadRequiredFieldsOrganization() {
     $params = array(
       'middle_name' => 'This field is not required',
       'contact_type' => 'Organization',
@@ -196,7 +195,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create individual contact with only an
    *  email succeeds
    */
-  function testCreateEmailIndividual() {
+  public function testCreateEmailIndividual() {
 
     $params = array(
       'email' => 'man3@yahoo.com',
@@ -218,7 +217,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create individual contact with only
    *  first and last names succeeds
    */
-  function testCreateNameIndividual() {
+  public function testCreateNameIndividual() {
     $params = array(
       'first_name' => 'abc1',
       'contact_type' => 'Individual',
@@ -233,7 +232,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create individual contact with
    *  first and last names and old key values works
    */
-  function testCreateNameIndividualOldKeys() {
+  public function testCreateNameIndividualOldKeys() {
     $params = array(
       'individual_prefix' => 'Dr.',
       'first_name' => 'abc1',
@@ -256,7 +255,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create individual contact with
    *  first and last names and old key values works
    */
-  function testCreateNameIndividualrecommendedKeys2() {
+  public function testCreateNameIndividualrecommendedKeys2() {
     $params = array(
       'prefix_id' => 'Dr.',
       'first_name' => 'abc1',
@@ -280,7 +279,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create household contact with only
    *  household name succeeds
    */
-  function testCreateNameHousehold() {
+  public function testCreateNameHousehold() {
     $params = array(
       'household_name' => 'The abc Household',
       'contact_type' => 'Household',
@@ -293,7 +292,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create organization contact with only
    *  organization name succeeds
    */
-  function testCreateNameOrganization() {
+  public function testCreateNameOrganization() {
     $params = array(
       'organization_name' => 'The abc Organization',
       'contact_type' => 'Organization',
@@ -301,23 +300,25 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $contact = $this->callAPISuccess('contact', 'create', $params);
     $this->assertEquals(1, $contact['id']);
   }
+
   /**
    *  Verify that attempt to create organization contact without organization name fails
    */
-  function testCreateNoNameOrganization() {
+  public function testCreateNoNameOrganization() {
     $params = array(
       'first_name' => 'The abc Organization',
       'contact_type' => 'Organization',
     );
     $this->callAPIFailure('contact', 'create', $params);
   }
+
   /**
    * Check with complete array + custom field
    * Note that the test is written on purpose without any
    * variables specific to participant so it can be replicated into other entities
    * and / or moved to the automated test suite
    */
-  function testCreateWithCustom() {
+  public function testCreateWithCustom() {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
 
     $params = $this->_params;
@@ -325,7 +326,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $description = "/*this demonstrates setting a custom field through the API ";
     $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description);
 
-    $check = $this->callAPISuccess($this->_entity, 'get', array('return.custom_' . $ids['custom_field_id'] => 1, 'id' => $result['id']));
+    $check = $this->callAPISuccess($this->_entity, 'get', array(
+      'return.custom_' . $ids['custom_field_id'] => 1,
+      'id' => $result['id'],
+    ));
     $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']]);
 
     $this->customFieldDelete($ids['custom_field_id']);
@@ -336,7 +340,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * CRM-12773 - expectation is that civicrm quietly ignores
    * fields without values
    */
-  function testCreateWithNULLCustomCRM12773() {
+  public function testCreateWithNULLCustomCRM12773() {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
     $params = $this->_params;
     $params['custom_' . $ids['custom_field_id']] = NULL;
@@ -346,29 +350,32 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   }
 
 
-  /*
+  /**
    * Test creating a current employer through API
    */
-  function testContactCreateCurrentEmployer(){
+  public function testContactCreateCurrentEmployer() {
     //here we will just do the get for set-up purposes
     $count = $this->callAPISuccess('contact', 'getcount', array(
       'organization_name' => 'new employer org',
-      'contact_type' => 'Organization'
+      'contact_type' => 'Organization',
     ));
     $this->assertEquals(0, $count);
     $employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
-      'current_employer' => 'new employer org',)
+        'current_employer' => 'new employer org',
+      )
     ));
     // do it again as an update to check it doesn't cause an error
     $employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
-        'current_employer' => 'new employer org', 'id' => $employerResult['id'])
+        'current_employer' => 'new employer org',
+        'id' => $employerResult['id'],
+      )
     ));
     $expectedCount = 1;
     $this->callAPISuccess('contact', 'getcount', array(
-      'organization_name' => 'new employer org',
-      'contact_type' => 'Organization'
-    ),
-    $expectedCount);
+        'organization_name' => 'new employer org',
+        'contact_type' => 'Organization',
+      ),
+      $expectedCount);
 
     $result = $this->callAPISuccess('contact', 'getsingle', array(
       'id' => $employerResult['id'],
@@ -377,43 +384,53 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertEquals('new employer org', $result['current_employer']);
 
   }
-  /*
+
+  /**
    * Test creating a current employer through API
    * - check it will re-activate a de-activated employer
-  */
-  function testContactCreateDuplicateCurrentEmployerEnables(){
+   */
+  public function testContactCreateDuplicateCurrentEmployerEnables() {
     //set up  - create employer relationship
     $employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
-        'current_employer' => 'new employer org',)
+        'current_employer' => 'new employer org',
+      )
     ));
-    $relationship = $this->callAPISuccess('relationship','get', array(
+    $relationship = $this->callAPISuccess('relationship', 'get', array(
       'contact_id_a' => $employerResult['id'],
-   ));
+    ));
 
     //disable & check it is disabled
     $this->callAPISuccess('relationship', 'create', array('id' => $relationship['id'], 'is_active' => 0));
-    $this->callAPISuccess('relationship','getvalue', array(
+    $this->callAPISuccess('relationship', 'getvalue', array(
       'id' => $relationship['id'],
-      'return' => 'is_active'
+      'return' => 'is_active',
     ), 0);
 
     //re-set the current employer - thus enabling the relationshp
     $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
-        'current_employer' => 'new employer org', 'id' => $employerResult['id'])
+        'current_employer' => 'new employer org',
+        'id' => $employerResult['id'],
+      )
     ));
     //check is_active is now 1
-   $relationship = $this->callAPISuccess('relationship','getsingle', array(
-     'return' => 'is_active',));
-   $this->assertEquals(1, $relationship['is_active']);
+    $relationship = $this->callAPISuccess('relationship', 'getsingle', array(
+      'return' => 'is_active',
+    ));
+    $this->assertEquals(1, $relationship['is_active']);
   }
 
   /**
    * Check deceased contacts are not retrieved
    * Note at time of writing the default is to return default. This should possibly be changed & test added
    */
-  function testGetDeceasedRetrieved() {
+  public function testGetDeceasedRetrieved() {
     $this->callAPISuccess($this->_entity, 'create', $this->_params);
-    $c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual', 'is_deceased' => 1));
+    $c2 = $this->callAPISuccess($this->_entity, 'create', array(
+      'first_name' => 'bb',
+      'last_name' => 'ccc',
+      'contact_type' => 'Individual',
+      'is_deceased' => 1,
+    ));
     $result = $this->callAPISuccess($this->_entity, 'get', array('is_deceased' => 0));
     $this->assertFalse(array_key_exists($c2['id'], $result['values']));
   }
@@ -421,15 +438,19 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test that sort works - old syntax
    */
-  function testGetSort() {
+  public function testGetSort() {
     $c1 = $this->callAPISuccess($this->_entity, 'create', $this->_params);
-    $c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual'));
+    $c2 = $this->callAPISuccess($this->_entity, 'create', array(
+      'first_name' => 'bb',
+      'last_name' => 'ccc',
+      'contact_type' => 'Individual',
+    ));
     $result = $this->callAPISuccess($this->_entity, 'get', array(
-        'sort' => 'first_name ASC',
-        'return.first_name' => 1,
-        'sequential' => 1,
-        'rowCount' => 1,
-      ));
+      'sort' => 'first_name ASC',
+      'return.first_name' => 1,
+      'sequential' => 1,
+      'rowCount' => 1,
+    ));
 
     $this->assertEquals('abc1', $result['values'][0]['first_name']);
     $result = $this->callAPISuccess($this->_entity, 'get', array(
@@ -443,14 +464,23 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->callAPISuccess($this->_entity, 'delete', array('id' => $c1['id']));
     $this->callAPISuccess($this->_entity, 'delete', array('id' => $c2['id']));
   }
-  /*
+
+  /**
    * Test that we can retrieve contacts using
    * 'id' => array('IN' => array('3,4')) syntax
-  */
-  function testGetINIDArray() {
+   */
+  public function testGetINIDArray() {
     $c1 = $this->callAPISuccess($this->_entity, 'create', $this->_params);
-    $c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual'));
-    $c3 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'hh', 'last_name' => 'll', 'contact_type' => 'Individual'));
+    $c2 = $this->callAPISuccess($this->_entity, 'create', array(
+      'first_name' => 'bb',
+      'last_name' => 'ccc',
+      'contact_type' => 'Individual',
+    ));
+    $c3 = $this->callAPISuccess($this->_entity, 'create', array(
+      'first_name' => 'hh',
+      'last_name' => 'll',
+      'contact_type' => 'Individual',
+    ));
     $result = $this->callAPISuccess($this->_entity, 'get', array('id' => array('IN' => array($c1['id'], $c3['id']))));
     $this->assertEquals(2, $result['count']);
     $this->assertEquals(array($c1['id'], $c3['id']), array_keys($result['values']));
@@ -458,10 +488,11 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->callAPISuccess($this->_entity, 'delete', array('id' => $c2['id']));
     $this->callAPISuccess($this->_entity, 'delete', array('id' => $c3['id']));
   }
-  /*
+
+  /**
    * Test variants on deleted behaviour
    */
-  function testGetDeleted() {
+  public function testGetDeleted() {
     $params = $this->_params;
     $contact1 = $this->callAPISuccess('contact', 'create', $params);
     $params['is_deleted'] = 1;
@@ -473,10 +504,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $countDefault = $this->callAPISuccess('contact', 'getcount', array());
     $countDeleted = $this->callAPISuccess('contact', 'getcount', array(
       'contact_is_deleted' => 1,
-      ));
+    ));
     $countNotDeleted = $this->callAPISuccess('contact', 'getcount', array(
       'contact_is_deleted' => 0,
-      ));
+    ));
     $this->callAPISuccess('contact', 'delete', array('id' => $contact1['id']));
     $this->callAPISuccess('contact', 'delete', array('id' => $contact2['id']));
     $this->assertEquals(1, $countNotDeleted, 'contact_is_deleted => 0 is respected in line ' . __LINE__);
@@ -490,25 +521,29 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test that sort works - new syntax
    */
-  function testGetSortNewSYntax() {
-    $c1     = $this->callAPISuccess($this->_entity, 'create', $this->_params);
-    $c2     = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual'));
+  public function testGetSortNewSYntax() {
+    $c1 = $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $c2 = $this->callAPISuccess($this->_entity, 'create', array(
+      'first_name' => 'bb',
+      'last_name' => 'ccc',
+      'contact_type' => 'Individual',
+    ));
     $result = $this->callAPISuccess($this->_entity, 'getvalue', array(
       'return' => 'first_name',
-        'options' => array(
-          'limit' => 1,
-          'sort' => 'first_name',
-        ),
-      ));
+      'options' => array(
+        'limit' => 1,
+        'sort' => 'first_name',
+      ),
+    ));
     $this->assertEquals('abc1', $result, 'in line' . __LINE__);
 
     $result = $this->callAPISuccess($this->_entity, 'getvalue', array(
-        'return' => 'first_name',
-        'options' => array(
-          'limit' => 1,
-          'sort' => 'first_name DESC',
-        ),
-      ));
+      'return' => 'first_name',
+      'options' => array(
+        'limit' => 1,
+        'sort' => 'first_name DESC',
+      ),
+    ));
     $this->assertEquals('bb', $result);
 
     $this->callAPISuccess($this->_entity, 'delete', array('id' => $c1['id']));
@@ -518,7 +553,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test apostrophe works in get & create
    */
-  function testGetApostropheCRM10857() {
+  public function testGetApostropheCRM10857() {
     $params = array_merge($this->_params, array('last_name' => "O'Connor"));
     $this->callAPISuccess($this->_entity, 'create', $params);
     $result = $this->callAPISuccess($this->_entity, 'getsingle', array(
@@ -534,7 +569,7 @@ class api_v3_ContactTest 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;
@@ -543,7 +578,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $subfile = "CustomFieldGet";
     $result = $this->callAPISuccess($this->_entity, 'create', $params);
 
-    $check = $this->callAPIAndDocument($this->_entity, 'get', array('return.custom_' . $ids['custom_field_id'] => 1, 'id' => $result['id']), __FUNCTION__, __FILE__, $description, $subfile);
+    $check = $this->callAPIAndDocument($this->_entity, 'get', array(
+      'return.custom_' . $ids['custom_field_id'] => 1,
+      'id' => $result['id'],
+    ), __FUNCTION__, __FILE__, $description, $subfile);
 
     $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']]);
     $fields = ($this->callAPISuccess('contact', 'getfields', $params));
@@ -558,7 +596,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * variables specific to participant so it can be replicated into other entities
    * and / or moved to the automated test suite
    */
-  function testGetWithCustomReturnSyntax() {
+  public function testGetWithCustomReturnSyntax() {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
 
     $params = $this->_params;
@@ -577,20 +615,28 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Check that address name is returned if required
    */
-  function testGetReturnAddressName () {
+  public function testGetReturnAddressName() {
     $contactID = $this->individualCreate();
-    $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'address_name' => 'My house', 'location_type_id' => 'Home', 'street_address' => '1 my road'));
-    $result = $this->callAPISuccessGetSingle('contact', array('return' => 'address_name, street_address', 'id' => $contactID));
+    $this->callAPISuccess('address', 'create', array(
+      'contact_id' => $contactID,
+      'address_name' => 'My house',
+      'location_type_id' => 'Home',
+      'street_address' => '1 my road',
+    ));
+    $result = $this->callAPISuccessGetSingle('contact', array(
+      'return' => 'address_name, street_address',
+      'id' => $contactID,
+    ));
     $this->assertEquals('1 my road', $result['street_address']);
     $this->assertEquals('My house', $result['address_name']);
 
   }
 
-  function testGetGroupIDFromContact() {
-    $groupId     = $this->groupCreate();
+  public function testGetGroupIDFromContact() {
+    $groupId = $this->groupCreate();
     $description = "Get all from group and display contacts";
-    $subFile     = "GroupFilterUsingContactAPI";
-    $params      = array(
+    $subFile = "GroupFilterUsingContactAPI";
+    $params = array(
       'email' => 'man2@yahoo.com',
       'contact_type' => 'Individual',
       'location_type_id' => 1,
@@ -625,18 +671,21 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->callAPISuccess('contact', 'get', $params);
 
     // testing as string
-    $params = array('filter.group_id' => array($groupId, 26),
+    $params = array(
+      'filter.group_id' => array($groupId, 26),
       'contact_type' => 'Individual',
     );
     $result = $this->callAPIAndDocument('contact', 'get', $params, __FUNCTION__, __FILE__, $description, $subFile);
     $this->assertEquals(1, $result['count']);
 
     //test in conjunction with other criteria
-      $params = array('filter.group_id' => array($groupId, 26),
+    $params = array(
+      'filter.group_id' => array($groupId, 26),
       'contact_type' => 'Organization',
     );
-   $this->callAPISuccess('contact', 'get', $params);
-    $params = array('filter.group_id' => array(26, 27),
+    $this->callAPISuccess('contact', 'get', $params);
+    $params = array(
+      'filter.group_id' => array(26, 27),
       'contact_type' => 'Individual',
     );
     $result = $this->callAPISuccess('contact', 'get', $params);
@@ -646,10 +695,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Verify that attempt to create individual contact with two chained websites succeeds
    */
-  function testCreateIndividualWithContributionDottedSyntax() {
+  public function testCreateIndividualWithContributionDottedSyntax() {
     $description = "test demonstrates the syntax to create 2 chained entities";
-    $subFile     = "ChainTwoWebsites";
-    $params      = array(
+    $subFile = "ChainTwoWebsites";
+    $params = array(
       'first_name' => 'abc3',
       'last_name' => 'xyz3',
       'contact_type' => 'Individual',
@@ -657,7 +706,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'api.contribution.create' => array(
         'receive_date' => '2010-01-01',
         'total_amount' => 100.00,
-        'financial_type_id'   => $this->_financialTypeId,
+        'financial_type_id' => $this->_financialTypeId,
         'payment_instrument_id' => 1,
         'non_deductible_amount' => 10.00,
         'fee_amount' => 50.00,
@@ -690,7 +739,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Verify that attempt to create individual contact with chained contribution and website succeeds
    */
-  function testCreateIndividualWithContributionChainedArrays() {
+  public function testCreateIndividualWithContributionChainedArrays() {
     $params = array(
       'first_name' => 'abc3',
       'last_name' => 'xyz3',
@@ -699,7 +748,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'api.contribution.create' => array(
         'receive_date' => '2010-01-01',
         'total_amount' => 100.00,
-        'financial_type_id'   => $this->_financialTypeId,
+        'financial_type_id' => $this->_financialTypeId,
         'payment_instrument_id' => 1,
         'non_deductible_amount' => 10.00,
         'fee_amount' => 50.00,
@@ -721,8 +770,8 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     );
 
     $description = "demonstrates creating two websites as an array";
-    $subfile     = "ChainTwoWebsitesSyntax2";
-    $result      = $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
+    $subfile = "ChainTwoWebsitesSyntax2";
+    $result = $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
 
     $this->assertEquals(1, $result['id']);
     // the callAndDocument doesn't check the chained call
@@ -737,7 +786,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create individual contact with first
    *  and last names and email succeeds
    */
-  function testCreateIndividualWithNameEmail() {
+  public function testCreateIndividualWithNameEmail() {
     $params = array(
       'first_name' => 'abc3',
       'last_name' => 'xyz3',
@@ -751,20 +800,22 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     // delete the contact
     $this->callAPISuccess('contact', 'delete', $contact);
   }
+
   /**
    *  Verify that attempt to create individual contact with no data fails
    */
-  function testCreateIndividualWithOutNameEmail() {
+  public function testCreateIndividualWithOutNameEmail() {
     $params = array(
       'contact_type' => 'Individual',
     );
     $this->callAPIFailure('contact', 'create', $params);
   }
+
   /**
    *  Verify that attempt to create individual contact with first
    *  and last names, email and location type succeeds
    */
-  function testCreateIndividualWithNameEmailLocationType() {
+  public function testCreateIndividualWithNameEmailLocationType() {
     $params = array(
       'first_name' => 'abc4',
       'last_name' => 'xyz4',
@@ -783,14 +834,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Verify that when changing employers
    * the old employer relationship becomes inactive
    */
-  function testCreateIndividualWithEmployer() {
+  public function testCreateIndividualWithEmployer() {
     $employer = $this->organizationCreate();
     $employer2 = $this->organizationCreate();
 
     $params = array(
-        'email' => 'man4@yahoo.com',
-        'contact_type' => 'Individual',
-        'employer_id' => $employer,
+      'email' => 'man4@yahoo.com',
+      'contact_type' => 'Individual',
+      'employer_id' => $employer,
     );
 
     $result = $this->callAPISuccess('contact', 'create', $params);
@@ -810,7 +861,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
         'is_active' => 1,
         'relationship_type_id' => $relTypeId,
       ));
-   }
+    }
 
     // Add second employer
     $params['employer_id'] = $employer2;
@@ -830,7 +881,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    *  Verify that attempt to create household contact with details
    *  succeeds
    */
-  function testCreateHouseholdDetails() {
+  public function testCreateHouseholdDetails() {
     $params = array(
       'household_name' => 'abc8\'s House',
       'nick_name' => 'x House',
@@ -844,11 +895,12 @@ class api_v3_ContactTest extends CiviUnitTestCase {
 
     $this->callAPISuccess('contact', 'delete', $contact);
   }
+
   /**
    *  Verify that attempt to create household contact with inadequate details
    *  fails
    */
-  function testCreateHouseholdInadequateDetails() {
+  public function testCreateHouseholdInadequateDetails() {
     $params = array(
       'nick_name' => 'x House',
       'email' => 'man8@yahoo.com',
@@ -860,7 +912,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Verify successful update of individual contact
    */
-  function testUpdateIndividualWithAll() {
+  public function testUpdateIndividualWithAll() {
     //  Insert a row in civicrm_contact creating individual contact
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn,
@@ -908,7 +960,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Verify successful update of organization contact
    */
-  function testUpdateOrganizationWithAll() {
+  public function testUpdateOrganizationWithAll() {
     //  Insert a row in civicrm_contact creating organization contact
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn,
@@ -941,7 +993,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Verify successful update of household contact
    */
-  function testUpdateHouseholdwithAll() {
+  public function testUpdateHouseholdwithAll() {
     //  Insert a row in civicrm_contact creating household contact
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn,
@@ -983,8 +1035,6 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       )
     );
 
-
-
     $params = array(
       'id' => 23,
       'first_name' => 'abcd',
@@ -996,7 +1046,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Test civicrm_contact_delete() with no contact ID
    */
-  function testContactDeleteNoID() {
+  public function testContactDeleteNoID() {
     $params = array(
       'foo' => 'bar',
     );
@@ -1006,7 +1056,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Test civicrm_contact_delete() with error
    */
-  function testContactDeleteError() {
+  public function testContactDeleteError() {
     $params = array('contact_id' => 999);
     $this->callAPIFailure('contact', 'delete', $params);
   }
@@ -1014,10 +1064,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Test civicrm_contact_delete()
    */
-  function testContactDelete() {
+  public function testContactDelete() {
     $contactID = $this->individualCreate();
     $params = array(
-      'id' => $contactID ,
+      'id' => $contactID,
     );
     $this->callAPIAndDocument('contact', 'delete', $params, __FUNCTION__, __FILE__);
   }
@@ -1206,10 +1256,16 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('contact', 'get', array('birth_date_high' => date('Y-m-d', strtotime('-6 years'))));
     $this->assertEquals(1, $result['count']);
     $this->assertEquals(date('Y-m-d', strtotime('first day of next month -20 years')), $result['values'][$contact3['id']]['birth_date']);
-    $result = $this->callAPISuccess('contact', 'get', array('birth_date_low' => date('Y-m-d', strtotime('-6 years')), 'birth_date_high' => date('Y-m-d', strtotime('- 3 years'))));
+    $result = $this->callAPISuccess('contact', 'get', array(
+      'birth_date_low' => date('Y-m-d', strtotime('-6 years')),
+      'birth_date_high' => date('Y-m-d', strtotime('- 3 years')),
+    ));
     $this->assertEquals(1, $result['count']);
     $this->assertEquals(date('Y-m-d', strtotime('first day of next month -5 years')), $result['values'][$contact2['id']]['birth_date']);
-    $result = $this->callAPISuccess('contact', 'get', array('birth_date_low' => '-6 years', 'birth_date_high' => '- 3 years'));
+    $result = $this->callAPISuccess('contact', 'get', array(
+      'birth_date_low' => '-6 years',
+      'birth_date_high' => '- 3 years',
+    ));
     $this->assertEquals(1, $result['count']);
     $this->assertEquals(date('Y-m-d', strtotime('first day of next month -5 years')), $result['values'][$contact2['id']]['birth_date']);
   }
@@ -1231,7 +1287,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('contact', 'get', array('deceased_date_high' => date('Y-m-d', strtotime('-6 years'))));
     $this->assertEquals(1, $result['count']);
     $this->assertEquals(date('Y-m-d', strtotime('first day of next month -20 years')), $result['values'][$contact3['id']]['deceased_date']);
-    $result = $this->callAPISuccess('contact', 'get', array('deceased_date_low' => '-6 years', 'deceased_date_high' => date('Y-m-d', strtotime('- 3 years'))));
+    $result = $this->callAPISuccess('contact', 'get', array(
+      'deceased_date_low' => '-6 years',
+      'deceased_date_high' => date('Y-m-d', strtotime('- 3 years')),
+    ));
     $this->assertEquals(1, $result['count']);
     $this->assertEquals(date('Y-m-d', strtotime('first day of next month -5 years')), $result['values'][$contact2['id']]['deceased_date']);
   }
@@ -1239,7 +1298,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test for Contact.get id=@user:username
    */
-  function testContactGetByUsername() {
+  public function testContactGetByUsername() {
     // setup - create contact with a uf-match
     $cid = $this->individualCreate(array(
       'contact_type' => 'Individual',
@@ -1274,30 +1333,33 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test to check return works OK
    */
-  function testContactGetReturnValues() {
+  public function testContactGetReturnValues() {
     $extraParams = array('nick_name' => 'Bob', 'phone' => '456', 'email' => 'e@mail.com');
     $contactID = $this->individualCreate($extraParams);
     //actually it turns out the above doesn't create a phone
-    $this->callAPISuccess('phone', 'create', array('contact_id' => $contactID, 'phone' => '456',));
+    $this->callAPISuccess('phone', 'create', array('contact_id' => $contactID, 'phone' => '456'));
     $result = $this->callAPISuccess('contact', 'getsingle', array('id' => $contactID));
     foreach ($extraParams as $key => $value) {
       $this->assertEquals($result[$key], $value);
     }
     //now we check they are still returned with 'return' key
-    $result = $this->callAPISuccess('contact', 'getsingle', array('id' => $contactID, 'return' => array_keys($extraParams)));
+    $result = $this->callAPISuccess('contact', 'getsingle', array(
+      'id' => $contactID,
+      'return' => array_keys($extraParams),
+    ));
     foreach ($extraParams as $key => $value) {
       $this->assertEquals($result[$key], $value);
     }
   }
 
-  function testCRM13252MultipleChainedPhones() {
+  public function testCRM13252MultipleChainedPhones() {
     $contactID = $this->householdCreate();
     $this->callAPISuccessGetCount('phone', array('contact_id' => $contactID), 0);
     $params = array(
-     'contact_id' => $contactID,
-     'household_name' => 'Household 1',
-     'contact_type' => 'Household',
-     'api.phone.create' => array(
+      'contact_id' => $contactID,
+      'household_name' => 'Household 1',
+      'contact_type' => 'Household',
+      'api.phone.create' => array(
         0 => array(
           'phone' => '111-111-1111',
           'location_type_id' => 1,
@@ -1307,17 +1369,18 @@ class api_v3_ContactTest extends CiviUnitTestCase {
           'phone' => '222-222-2222',
           'location_type_id' => 1,
           'phone_type_id' => 2,
-        )
-      )
+        ),
+      ),
     );
     $this->callAPISuccess('contact', 'create', $params);
     $this->callAPISuccessGetCount('phone', array('contact_id' => $contactID), 2);
 
   }
+
   /**
    * Test for Contact.get id=@user:username (with an invalid username)
    */
-  function testContactGetByUnknownUsername() {
+  public function testContactGetByUnknownUsername() {
     // setup - mock the calls to CRM_Utils_System_*::getUfId
     $userSystem = $this->getMock('CRM_Utils_System_UnitTests', array('getUfId'));
     $userSystem->expects($this->once())
@@ -1336,14 +1399,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    *  Verify attempt to create individual with chained arrays
    */
-  function testGetIndividualWithChainedArrays() {
+  public function testGetIndividualWithChainedArrays() {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
     $params['custom_' . $ids['custom_field_id']] = "custom string";
 
-    $moreids     = $this->CustomGroupMultipleCreateWithFields();
+    $moreids = $this->CustomGroupMultipleCreateWithFields();
     $description = "/*this demonstrates the usage of chained api functions. In this case no notes or custom fields have been created ";
-    $subfile     = "APIChainedArray";
-    $params      = array(
+    $subfile = "APIChainedArray";
+    $params = array(
       'first_name' => 'abc3',
       'last_name' => 'xyz3',
       'contact_type' => 'Individual',
@@ -1364,7 +1427,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'api.contribution.create.1' => array(
         'receive_date' => '2011-01-01',
         'total_amount' => 120.00,
-        'financial_type_id' => $this->_financialTypeId =1,
+        'financial_type_id' => $this->_financialTypeId = 1,
         'payment_instrument_id' => 1,
         'non_deductible_amount' => 10.00,
         'fee_amount' => 50.00,
@@ -1387,7 +1450,8 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'api.website.get' => array(),
       'api.Contribution.get' => array(
         'total_amount' => '120.00',
-      ), 'api.CustomValue.get' => 1,
+      ),
+      'api.CustomValue.get' => 1,
       'api.Note.get' => 1,
     );
     $result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
@@ -1400,7 +1464,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertEquals("http://civicrm.org", $result['values'][$result['id']]['api.website.get']['values'][0]['url']);
   }
 
-  function testGetIndividualWithChainedArraysFormats() {
+  public function testGetIndividualWithChainedArraysFormats() {
     $description = "/*this demonstrates the usage of chained api functions. A variety of return formats are used. Note that no notes
     *custom fields or memberships exist";
     $subfile = "APIChainedArrayFormats";
@@ -1442,7 +1506,6 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       ),
     );
 
-
     $result = $this->callAPISuccess('Contact', 'create', $params);
     $params = array(
       'id' => $result['id'],
@@ -1463,11 +1526,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->customGroupDelete($moreids['custom_group_id']);
   }
 
-  function testGetIndividualWithChainedArraysAndMultipleCustom() {
+  public function testGetIndividualWithChainedArraysAndMultipleCustom() {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
     $params['custom_' . $ids['custom_field_id']] = "custom string";
     $moreids = $this->CustomGroupMultipleCreateWithFields();
-    $andmoreids = $this->CustomGroupMultipleCreateWithFields(array('title' => "another group", 'name' => 'another name'));
+    $andmoreids = $this->CustomGroupMultipleCreateWithFields(array(
+      'title' => "another group",
+      'name' => 'another name',
+    ));
     $description = "/*this demonstrates the usage of chained api functions. A variety of techniques are used";
     $subfile = "APIChainedArrayMultipleCustom";
     $params = array(
@@ -1478,7 +1544,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'api.contribution.create' => array(
         'receive_date' => '2010-01-01',
         'total_amount' => 100.00,
-        'financial_type_id'   => 1,
+        'financial_type_id' => 1,
         'payment_instrument_id' => 1,
         'non_deductible_amount' => 10.00,
         'fee_amount' => 50.00,
@@ -1491,7 +1557,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'api.contribution.create.1' => array(
         'receive_date' => '2011-01-01',
         'total_amount' => 120.00,
-        'financial_type_id'   => 1,
+        'financial_type_id' => 1,
         'payment_instrument_id' => 1,
         'non_deductible_amount' => 10.00,
         'fee_amount' => 50.00,
@@ -1512,11 +1578,15 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'custom_' . $andmoreids['custom_field_id'][1] => "vegemite",
     );
 
-
     $result = $this->callAPISuccess('Contact', 'create', $params);
     $result = $this->callAPISuccess('Contact', 'create', array(
-      'contact_type' => 'Individual', 'id' => $result['id'], 'custom_' . $moreids['custom_field_id'][0] => "value 3", 'custom_' . $ids['custom_field_id'] => "value 4",
-      ));
+      'contact_type' => 'Individual',
+      'id' => $result['id'],
+      'custom_' .
+      $moreids['custom_field_id'][0] => "value 3",
+      'custom_' .
+      $ids['custom_field_id'] => "value 4",
+    ));
 
     $params = array(
       'id' => $result['id'],
@@ -1533,15 +1603,17 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertEquals(0, $result['values'][$result['id']]['api.CustomValue.get']['is_error']);
     $this->assertEquals('http://civicrm.org', $result['values'][$result['id']]['api.website.getValue']);
   }
-  /*
+
+  /**
    * Test checks siusage of $values to pick & choose inputs
    */
-  function testChainingValuesCreate() {
+  public function testChainingValuesCreate() {
     $description = "/*this demonstrates the usage of chained api functions.  Specifically it has one 'parent function' &
     2 child functions - one receives values from the parent (Contact) and the other child (Tag). ";
     $subfile = "APIChainedArrayValuesFromSiblingFunction";
     $params = array(
-      'display_name' => 'batman', 'contact_type' => 'Individual',
+      'display_name' => 'batman',
+      'contact_type' => 'Individual',
       'api.tag.create' => array('name' => '$value.id', 'description' => '$value.display_name', 'format.only_id' => 1),
       'api.entity_tag.create' => array('tag_id' => '$value.api.tag.create'),
     );
@@ -1557,85 +1629,88 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->quickCleanup($tablesToTruncate, TRUE);
   }
 
-  /*
+  /**
    * test TrueFalse format - I couldn't come up with an easy way to get an error on Get
    */
-  function testContactGetFormatIsSuccessTrue() {
+  public function testContactGetFormatIsSuccessTrue() {
     $this->createContactFromXML();
     $description = "This demonstrates use of the 'format.is_success' param.
     This param causes only the success or otherwise of the function to be returned as BOOLEAN";
     $subfile = "FormatIsSuccess_True";
-    $params  = array('id' => 17, 'format.is_success' => 1);
-    $result  = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
+    $params = array('id' => 17, 'format.is_success' => 1);
+    $result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals(1, $result);
     $this->callAPISuccess('Contact', 'Delete', $params);
   }
-  /*
+
+  /**
    * test TrueFalse format
    */
-  function testContactCreateFormatIsSuccessFalse() {
+  public function testContactCreateFormatIsSuccessFalse() {
 
     $description = "This demonstrates use of the 'format.is_success' param.
     This param causes only the success or otherwise of the function to be returned as BOOLEAN";
     $subfile = "FormatIsSuccess_Fail";
-    $params  = array('id' => 500, 'format.is_success' => 1);
-    $result  = $this->callAPIAndDocument('Contact', 'Create', $params, __FUNCTION__, __FILE__, $description, $subfile);
+    $params = array('id' => 500, 'format.is_success' => 1);
+    $result = $this->callAPIAndDocument('Contact', 'Create', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals(0, $result);
   }
-  /*
+
+  /**
    * test Single Entity format
    */
-  function testContactGetSingle_entity_array() {
+  public function testContactGetSingle_entity_array() {
     $this->createContactFromXML();
     $description = "This demonstrates use of the 'format.single_entity_array' param.
     /* This param causes the only contact to be returned as an array without the other levels.
     /* it will be ignored if there is not exactly 1 result";
     $subfile = "GetSingleContact";
-    $params  = array('id' => 17);
-    $result  = $this->callAPIAndDocument('Contact', 'GetSingle', $params, __FUNCTION__, __FILE__, $description, $subfile);
+    $params = array('id' => 17);
+    $result = $this->callAPIAndDocument('Contact', 'GetSingle', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals('Test Contact', $result['display_name']);
     $this->callAPISuccess('Contact', 'Delete', $params);
   }
 
-  /*
+  /**
    * test Single Entity format
    */
-  function testContactGetFormatcount_only() {
+  public function testContactGetFormatcount_only() {
     $this->createContactFromXML();
     $description = "/*This demonstrates use of the 'getCount' action
     /*  This param causes the count of the only function to be returned as an integer";
     $subfile = "GetCountContact";
-    $params  = array('id' => 17);
-    $result  = $this->callAPIAndDocument('Contact', 'GetCount', $params, __FUNCTION__, __FILE__, $description, $subfile);
+    $params = array('id' => 17);
+    $result = $this->callAPIAndDocument('Contact', 'GetCount', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals('1', $result);
     $this->callAPISuccess('Contact', 'Delete', $params);
   }
-  /*
+
+  /**
     * Test id only format
     */
-  function testContactGetFormatID_only() {
+  public function testContactGetFormatID_only() {
     $this->createContactFromXML();
     $description = "This demonstrates use of the 'format.id_only' param.
     /* This param causes the id of the only entity to be returned as an integer.
     /* it will be ignored if there is not exactly 1 result";
     $subfile = "FormatOnlyID";
-    $params  = array('id' => 17, 'format.only_id' => 1);
-    $result  = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
+    $params = array('id' => 17, 'format.only_id' => 1);
+    $result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals('17', $result);
     $this->callAPISuccess('Contact', 'Delete', $params);
   }
 
-  /*
+  /**
     * Test id only format
     */
-  function testContactGetFormatSingleValue() {
+  public function testContactGetFormatSingleValue() {
     $this->createContactFromXML();
     $description = "This demonstrates use of the 'format.single_value' param.
     /* This param causes only a single value of the only entity to be returned as an string.
     /* it will be ignored if there is not exactly 1 result";
     $subFile = "FormatSingleValue";
-    $params  = array('id' => 17, 'return' => 'display_name');
-    $result  = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile,'getvalue');
+    $params = array('id' => 17, 'return' => 'display_name');
+    $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile, 'getvalue');
     $this->assertEquals('Test Contact', $result);
     $this->callAPISuccess('Contact', 'Delete', $params);
   }
@@ -1643,9 +1718,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test that permissions are respected when creating contacts
    */
-  function testContactCreationPermissions() {
+  public function testContactCreationPermissions() {
     $params = array(
-      'contact_type' => 'Individual', 'first_name' => 'Foo',
+      'contact_type' => 'Individual',
+      'first_name' => 'Foo',
       'last_name' => 'Bear',
       'check_permissions' => TRUE,
     );
@@ -1658,21 +1734,37 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->callAPISuccess('contact', 'create', $params, NULL, 'overfluous permissions should be enough to create a contact');
   }
 
-  function testContactUpdatePermissions() {
-    $params = array('contact_type' => 'Individual', 'first_name' => 'Foo', 'last_name' => 'Bear', 'check_permissions' => TRUE,);
+  public function testContactUpdatePermissions() {
+    $params = array(
+      'contact_type' => 'Individual',
+      'first_name' => 'Foo',
+      'last_name' => 'Bear',
+      'check_permissions' => TRUE,
+    );
     $result = $this->callAPISuccess('contact', 'create', $params);
     $config = CRM_Core_Config::singleton();
-    $params = array('id' => $result['id'], 'contact_type' => 'Individual', 'last_name' => 'Bar', 'check_permissions' => TRUE,);
+    $params = array(
+      'id' => $result['id'],
+      'contact_type' => 'Individual',
+      'last_name' => 'Bar',
+      'check_permissions' => TRUE,
+    );
 
     $config->userPermissionClass->permissions = array('access CiviCRM');
     $result = $this->callAPIFailure('contact', 'update', $params);
     $this->assertEquals('API permission check failed for contact/update call; insufficient permission: require access CiviCRM and edit all contacts', $result['error_message'], 'lacking permissions should not be enough to update a contact');
 
-    $config->userPermissionClass->permissions = array('access CiviCRM', 'add contacts', 'view all contacts', 'edit all contacts', 'import contacts');
+    $config->userPermissionClass->permissions = array(
+      'access CiviCRM',
+      'add contacts',
+      'view all contacts',
+      'edit all contacts',
+      'import contacts',
+    );
     $this->callAPISuccess('contact', 'update', $params, NULL, 'overfluous permissions should be enough to update a contact');
   }
 
-  function createContactFromXML() {
+  public function createContactFromXML() {
     //  Insert a row in civicrm_contact creating contact 17
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn,
@@ -1682,7 +1774,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     );
   }
 
-  function testContactProximity() {
+  public function testContactProximity() {
     // first create a contact with a SF location with a specific
     // geocode
     $contactID = $this->organizationCreate();
@@ -1719,7 +1811,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Test that Ajax API permission is sufficient to access getquick api
    * (note that getquick api is required for autocomplete & has ACL permissions applied)
    */
-  function testGetquickPermission_CRM_13744() {
+  public function testGetquickPermission_CRM_13744() {
     CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviEvent');
     $this->callAPIFailure('contact', 'getquick', array('name' => 'b', 'check_permissions' => TRUE));
     CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM');
@@ -1731,7 +1823,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test get ref api - gets a list of references to an entity
    */
-  function testGetReferenceCounts() {
+  public function testGetReferenceCounts() {
     $result = $this->callAPISuccess('Contact', 'create', array(
       'first_name' => 'Testily',
       'last_name' => 'McHaste',
@@ -1745,7 +1837,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
             'email' => 'spam@dev.null',
             'is_primary' => 0,
             'location_type_id' => 1,
-          )
+          ),
         ),
       ),
       'api.Phone.replace' => array(
@@ -1773,7 +1865,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     //$refCountsIdx = CRM_Utils_Array::index(array('name'), $refCounts);
 
     $refCounts = $this->callAPISuccess('Contact', 'getrefcount', array(
-      'id' => $result['id']
+      'id' => $result['id'],
     ));
     $refCountsIdx = CRM_Utils_Array::index(array('name'), $refCounts['values']);
 
@@ -1784,7 +1876,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertTrue(!isset($refCountsIdx['sql:civicrm_address:contact_id']));
   }
 
-  function testSQLOperatorsOnContactAPI() {
+  public function testSQLOperatorsOnContactAPI() {
     $this->individualCreate();
     $this->organizationCreate();
     $this->householdCreate();
@@ -1797,7 +1889,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * CRM-14743 - test api respects search operators
    */
-  function testGetModifiedDateByOperators() {
+  public function testGetModifiedDateByOperators() {
     $preExistingContactCount = CRM_Core_DAO::singleValueQuery('select count(*) FROM civicrm_contact');
     $contact1 = $this->individualCreate();
     $sql = "UPDATE civicrm_contact SET created_date = '2012-01-01', modified_date = '2013-01-01' WHERE id = " . $contact1;
@@ -1817,7 +1909,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * CRM-14743 - test api respects search operators
    */
-  function testGetCreatedDateByOperators() {
+  public function testGetCreatedDateByOperators() {
     $preExistingContactCount = CRM_Core_DAO::singleValueQuery('select count(*) FROM civicrm_contact');
     $contact1 = $this->individualCreate();
     $sql = "UPDATE civicrm_contact SET created_date = '2012-01-01' WHERE id = " . $contact1;
@@ -1837,10 +1929,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * CRM-14263 check that API is not affected by search profile related bug
    */
-  function testReturnCityProfile () {
+  public function testReturnCityProfile() {
     $contactID = $this->individualCreate();
     CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
-    $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
+    $this->callAPISuccess('address', 'create', array(
+      'contact_id' => $contactID,
+      'city' => 'Cool City',
+      'location_type_id' => 1,
+    ));
     $result = $this->callAPISuccess('contact', 'get', array('city' => 'Cool City', 'return' => 'contact_type'));
     $this->assertEquals(1, $result['count']);
   }
@@ -1848,7 +1944,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * CRM-15443 - ensure getlist api does not return deleted contacts
    */
-  function testGetlistExcludeConditions() {
+  public function testGetlistExcludeConditions() {
     $name = md5(time());
     $contact = $this->individualCreate(array('last_name' => $name));
     $deceasedContact = $this->individualCreate(array('last_name' => $name, 'is_deceased' => 1));
@@ -1857,7 +1953,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('contact', 'getlist', array('input' => $name));
     $this->assertEquals(2, $result['count'], 'In line ' . __LINE__);
     // Force-exclude the deceased contact
-    $result = $this->callAPISuccess('contact', 'getlist', array('input' => $name, 'params' => array('is_deceased' => 0)));
+    $result = $this->callAPISuccess('contact', 'getlist', array(
+      'input' => $name,
+      'params' => array('is_deceased' => 0),
+    ));
     $this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
     $this->assertEquals($contact, $result['values'][0]['id'], 'In line ' . __LINE__);
   }
@@ -1865,7 +1964,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   /**
    * Test contact.getactions
    */
-  function testGetActions() {
+  public function testGetActions() {
     $description = "Getting the available actions for an entity.";
     $result = $this->callAPIAndDocument($this->_entity, 'getactions', array(), __FUNCTION__, __FILE__, $description);
     $expected = array(