Merge pull request #5536 from totten/4.5-httpclient
[civicrm-core.git] / tests / phpunit / api / v3 / PledgePaymentTest.php
index 1cfbd7492885b5884ba0f99eb82080b1cf36ea30..53210584f383c13df3cf952ba04f9d7e72e2eb3e 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.                                    |
  |                                                                    |
  | 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';
 
 /**
  * Test class for Pledge API - civicrm_pledge_*
  *
- *  @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
  */
-
 class api_v3_PledgePaymentTest extends CiviUnitTestCase {
 
   /**
-   * Assume empty database with just civicrm_data
+   * Assume empty database with just civicrm_data.
    */
   protected $_individualId;
   protected $_pledgeID;
@@ -72,7 +71,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test that passing in a single variable works
+   * Test that passing in a single variable works.
    */
   public function testGetSinglePledgePayment() {
     $createparams = array(
@@ -109,7 +108,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test that creating a payment will add the contribution ID
+   * Test that creating a payment will add the contribution ID.
    */
   public function testCreatePledgePayment() {
     //check that 5 pledge payments exist at the start
@@ -145,7 +144,6 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
     $contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
     $params['contribution_id'] = $contribution['id'];
 
-
     $resultCont2 = $this->callAPISuccess('pledge_payment', 'create', $params);
     //make sure original is untouched & has not been updated
     $this->assertGreaterThan($result['id'], $resultCont2['id'], " in line " . __LINE__);
@@ -155,7 +153,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test checks behaviour when more payments are created than should be possible
+   * Test checks behaviour when more payments are created than should be possible.
    */
   public function testCreatePledgePaymentAllCreated() {
     $params = array(
@@ -190,15 +188,14 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
     $params['scheduled_date'] = '20131212';
     $resultcreatenew = $this->callAPISuccess('pledge_payment', 'create', $params);
     $result = $this->callAPISuccess('PledgePayment', 'Get', array(
-        'pledge_id' => $this->_pledgeID,
-      ));
+      'pledge_id' => $this->_pledgeID,
+    ));
 
     $this->assertEquals(6, $result['count']);
   }
 
   /**
-   * Test that creating a payment will add the contribution ID where only one pledge payment
-   * in schedule
+   * Test that creating a payment adds the contribution ID where only one pledge payment is in schedule.
    */
   public function testCreatePledgePaymentWhereOnlyOnePayment() {
     $pledgeParams = array(
@@ -233,7 +230,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
     //check existing updated not new one created - 'create' means add contribution_id in this context
     $afterAdd = $this->callAPISuccess('pledge_payment', 'get', array(
       'contribution_id' => $contributionID,
-      ));
+    ));
     $this->assertEquals(1, $afterAdd['count'], " in line " . __LINE__);
   }
 
@@ -251,7 +248,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
     );
 
     $result = $this->callAPIAndDocument('pledge_payment', 'update', $updateparams, __FUNCTION__, __FILE__);
-    $this->getAndCheck(array_merge($params,$updateparams), $result['id'], $this->_entity);
+    $this->getAndCheck(array_merge($params, $updateparams), $result['id'], $this->_entity);
   }
 
   public function testDeletePledgePayment() {
@@ -275,4 +272,5 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('PledgePayment', 'GetFields', array());
     $this->assertType('array', $result);
   }
+
 }