$title .= " - {$info['title']}";
}
$this->assign('transaction', TRUE);
- $this->assign('payments', $paymentInfo['transaction']);
+ $this->assign('payments', $paymentInfo['transaction'] ?? NULL);
$this->assign('paymentLinks', $paymentInfo['payment_links']);
return $title;
}
}
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('dataArray', $dataArray);
- $smarty->assign('totalTaxAmount', $params['tax_amount']);
+ $smarty->assign('totalTaxAmount', $params['tax_amount'] ?? NULL);
}
// lets store it in the form variable so postProcess hook can get to this and use it
$this->membershipDelete($membership['id']);
}
+ /**
+ * Test no warnings or errors during preProcess when editing.
+ */
+ public function testPreProcessContributionEdit() {
+ // Simulate a contribution in pending status
+ $contribution = $this->callAPISuccess(
+ 'Contribution',
+ 'create',
+ array_merge($this->_params, ['contribution_status_id' => 'Pending'])
+ );
+
+ // set up the form to edit the contribution and call preProcess
+ $form = $this->getFormObject('CRM_Contribute_Form_Contribution');
+ $_REQUEST['cid'] = $this->_individualId;
+ $_REQUEST['id'] = $contribution['id'];
+ $form->_action = CRM_Core_Action::UPDATE;
+ $form->preProcess();
+
+ // Check something while we're here
+ $this->assertEquals($contribution['id'], $form->_values['contribution_id']);
+
+ unset($_REQUEST['cid']);
+ unset($_REQUEST['id']);
+ }
+
}