Add unit test coverage for financial_type_id
authorMatthew Wire <devel@mrwire.co.uk>
Sat, 28 Apr 2018 20:32:53 +0000 (21:32 +0100)
committerMatthew Wire <devel@mrwire.co.uk>
Sun, 29 Apr 2018 19:41:03 +0000 (20:41 +0100)
tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php

index d7e09bb696f60bceb1e90d23a42b9a7f25aa7802..bb594d6e7b5284ebe18caa9d3d1fb3bb3a2e3e00 100644 (file)
@@ -120,16 +120,20 @@ class CRM_Contribute_Form_Contribution_ConfirmTest extends CiviUnitTestCase {
       'skipLineItem' => 0,
     );
 
-    $result = CRM_Contribute_BAO_Contribution_Utils::processConfirm($form,
+    $processConfirmResult = CRM_Contribute_BAO_Contribution_Utils::processConfirm($form,
       $form->_params,
       $contactID,
       $form->_values['financial_type_id'],
       0, FALSE
     );
+
+    // Make sure that certain parameters are set on return from processConfirm
+    $this->assertEquals($form->_values['financial_type_id'], $processConfirmResult['financial_type_id']);
+
     // Based on the processed contribution, complete transaction which update the contribution status based on payment result.
-    if (!empty($result['contribution'])) {
+    if (!empty($processConfirmResult['contribution'])) {
       $this->callAPISuccess('contribution', 'completetransaction', array(
-        'id' => $result['contribution']->id,
+        'id' => $processConfirmResult['contribution']->id,
         'trxn_date' => date('Y-m-d'),
         'payment_processor_id' => $paymentProcessorID,
       ));