Merge pull request #6289 from yashodha/CRM-16879
[civicrm-core.git] / tests / phpunit / api / v3 / ContributionSoftTest.php
index 8ae38e1fdfe16dc793106c39017a1afe79c8135c..bbe03ca8137de87c733167f2bcdccfb8354db1b0 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -23,7 +23,7 @@
  | 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';
 
@@ -33,11 +33,10 @@ require_once 'CiviTest/CiviUnitTestCase.php';
  * @package CiviCRM_APIv3
  * @subpackage API_ContributionSoft
  */
-
 class api_v3_ContributionSoftTest extends CiviUnitTestCase {
 
   /**
-   * Assume empty database with just civicrm_data
+   * Assume empty database with just civicrm_data.
    */
   protected $_individualId; //the hard credit contact
   protected $_softIndividual1Id; //the first soft credit contact
@@ -64,7 +63,7 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
       'contact_id' => $this->_individualId,
       'receive_date' => '20120511',
       'total_amount' => 100.00,
-      'financial_type_id'   => $this->_financialTypeId,
+      'financial_type_id' => $this->_financialTypeId,
       'non_deductible_amount' => 10.00,
       'fee_amount' => 5.00,
       'net_amount' => 95.00,
@@ -85,7 +84,7 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test get methods
+   * Test get methods.
    * @todo - this might be better broken down into more smaller tests
    */
   public function testGetContributionSoft() {
@@ -135,7 +134,8 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
 
     //test get by contact id works
     $result = $this->callAPISuccess('contribution_soft', 'get', array(
-      'contact_id' => $this->_softIndividual2Id)
+        'contact_id' => $this->_softIndividual2Id,
+      )
     );
     $this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
 
@@ -151,11 +151,13 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
 
     $this->callAPISuccess('ContributionSoft', 'Delete', array(
       'id' => $this->_softcontribution2['id'],
-     ));
+    ));
   }
 
 
-  ///////////////// civicrm_contribution_soft
+  /**
+   * civicrm_contribution_soft.
+   */
   public function testCreateEmptyParamsContributionSoft() {
     $softcontribution = $this->callAPIFailure('contribution_soft', 'create', array(),
       'Mandatory key(s) missing from params array: contribution_id, amount, contact_id'
@@ -169,7 +171,6 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
   }
 
   public function testCreateContributionSoftInvalidContact() {
-
     $params = array(
       'contact_id' => 999,
       'contribution_id' => $this->_contributionId,
@@ -183,7 +184,6 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
   }
 
   public function testCreateContributionSoftInvalidContributionId() {
-
     $params = array(
       'contribution_id' => 999999,
       'contact_id' => $this->_softIndividual1Id,
@@ -196,8 +196,8 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
     );
   }
 
-  /*
-   * Function tests that additional financial records are created when fee amount is recorded
+  /**
+   * Function tests that additional financial records are created when fee amount is recorded.
    */
   public function testCreateContributionSoft() {
     $params = array(
@@ -216,7 +216,10 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
     $this->assertEquals($softcontribution['values'][$softcontribution['id']]['soft_credit_type_id'], 5, 'In line ' . __LINE__);
   }
 
-  //To Update Soft Contribution
+  /**
+   * To Update Soft Contribution.
+   *
+   */
   public function testCreateUpdateContributionSoft() {
     //create a soft credit
     $params = array(
@@ -277,7 +280,10 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('contribution_soft', 'delete', $params);
   }
 
-  ///////////////// civicrm_contribution_soft_delete methods
+  /**
+   * civicrm_contribution_soft_delete methods.
+   *
+   */
   public function testDeleteEmptyParamsContributionSoft() {
     $params = array();
     $softcontribution = $this->callAPIFailure('contribution_soft', 'delete', $params);
@@ -310,8 +316,8 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
   ///////////////// civicrm_contribution_search methods
 
   /**
-   *  Test civicrm_contribution_search with empty params.
-   *  All available contributions expected.
+   * Test civicrm_contribution_search with empty params.
+   * All available contributions expected.
    */
   public function testSearchEmptyParams() {
     $p = array(
@@ -333,7 +339,7 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
   }
 
   /**
-   *  Test civicrm_contribution_soft_search. Success expected.
+   * Test civicrm_contribution_soft_search. Success expected.
    */
   public function testSearch() {
     $p1 = array(
@@ -363,4 +369,5 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
     $this->assertEquals($p2['amount'], $res['amount'], 'In line ' . __LINE__);
     $this->assertEquals($p2['currency'], $res['currency'], 'In line ' . __LINE__);
   }
+
 }