CRM-16189, fixed jenkins test
[civicrm-core.git] / tests / phpunit / CRM / Contribute / BAO / ContributionTest.php
index 4b865a37526e5944daa373d392db8f73023e291d..d4a3e0d2e51bf7ee8d29c3fc66caf79c62ab0699 100644 (file)
@@ -499,7 +499,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
     );
     $defaults = array();
     $financialTrxn = CRM_Core_BAO_FinancialTrxn::retrieve($trxnArray, $defaults);
-    $this->assertEquals(2, $financialTrxn->N, 'Mismatch count for is payment flag.');
+    $this->assertEquals(1, $financialTrxn->N, 'Mismatch count for is payment flag.');
     //update contribution amount
     $ids = array('contribution' => $contribution->id);
     $params['total_amount'] = 150;
@@ -514,10 +514,10 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
     );
     $defaults = array();
     $financialTrxn = CRM_Core_BAO_FinancialTrxn::retrieve($trxnArray, $defaults);
-    $this->assertEquals(3, $financialTrxn->N, 'Mismatch count for is payment flag.');
+    $this->assertEquals(2, $financialTrxn->N, 'Mismatch count for is payment flag.');
     $trxnArray['is_payment'] = 0;
     $financialTrxn = CRM_Core_BAO_FinancialTrxn::retrieve($trxnArray, $defaults);
-    $this->assertEquals(NULL, $financialTrxn, 'Mismatch count for is payment flag.');
+    $this->assertEquals(1, $financialTrxn->N, 'Mismatch count for is payment flag.');
   }
 
   /**
@@ -585,9 +585,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
    */
   public function testAddPayments() {
     list($lineItems, $contribution) = $this->addParticipantWithContribution();
-    foreach ($lineItems as $value) {
-      CRM_Contribute_BAO_Contribution::addPayments($value, array($contribution));
-    }
+    CRM_Contribute_BAO_Contribution::addPayments(array($contribution));
     $this->checkItemValues($contribution);
   }
 
@@ -617,7 +615,6 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
    */
   public function testAssignProportionalLineItems() {
     list($lineItems, $contribution) = $this->addParticipantWithContribution();
-    $contributions['total_amount'] = $contribution->total_amount;
     $params = array(
       'contribution_id' => $contribution->id,
       'total_amount' => 150.00,
@@ -625,7 +622,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     $trxn = new CRM_Financial_DAO_FinancialTrxn();
     $trxn->orderBy('id DESC');
     $trxn->find(TRUE);
-    CRM_Contribute_BAO_Contribution::assignProportionalLineItems($params, $trxn, $contributions);
+    CRM_Contribute_BAO_Contribution::assignProportionalLineItems($params, $trxn->id, $contribution->total_amount);
     $this->checkItemValues($contribution);
   }
 
@@ -855,7 +852,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
       'contact_id' => $contactId,
       'receive_date' => '2010-01-20',
       'total_amount' => 100,
-      'financial_type_id' => 3,
+      'financial_type_id' => 4,
     );
     $order = $this->callAPISuccess('order', 'create', $params);
     $allowUpdate = CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($order['id']);
@@ -866,8 +863,8 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
       'contact_id' => $contactId,
       'receive_date' => '2010-01-20',
       'total_amount' => 300,
-      'financial_type_id' => 1,
-      'contribution_status_id' => 1,
+      'financial_type_id' => $this->getFinancialTypeId('Event Fee'),
+      'contribution_status_id' => 'Completed',
     );
     $priceFields = $this->createPriceSet('event', $event['id']);
     foreach ($priceFields['values'] as $key => $priceField) {
@@ -902,8 +899,8 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
       'contact_id' => $contactId,
       'receive_date' => '2010-01-20',
       'total_amount' => 200,
-      'financial_type_id' => 2,
-      'contribution_status_id' => 1,
+      'financial_type_id' => $this->getFinancialTypeId('Member Dues'),
+      'contribution_status_id' => 'Completed',
     );
     $membershipType = $this->membershipTypeCreate();
     $priceFields = $this->createPriceSet();