/**
* Membership type name used in test function.
- * @var String
+ *
+ * @var string
*/
protected $_membershipTypeName = NULL;
/**
* Membership type id used in test function.
- * @var String
+ *
+ * @var string
*/
protected $_membershipTypeID = NULL;
/**
* Contact id used in test function.
- * @var String
+ *
+ * @var string
*/
protected $_contactID = NULL;
/**
* Contact id used in test function.
- * @var String
+ *
+ * @var string
*/
protected $_contactID2 = NULL;
/**
* Contact id used in test function.
- * @var String
+ *
+ * @var string
*/
protected $_contactID3 = NULL;
/**
* Contact id used in test function.
- * @var String
+ *
+ * @var string
*/
protected $_contactID4 = NULL;
$params = array(
'name' => $this->_membershipTypeName,
'description' => NULL,
- 'minimum_fee' => 10,
+ 'minimum_fee' => 1500,
'duration_unit' => 'year',
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'fixed',
/**
* Test Import.
+ *
+ * @param string $thousandSeparator
+ *
+ * @dataProvider getThousandSeparators
*/
- public function testProcessMembership() {
+ public function testProcessMembership($thousandSeparator) {
+ $this->setCurrencySeparators($thousandSeparator);
+
$form = new CRM_Batch_Form_Entry();
+ $profileID = $this->callAPISuccessGetValue('UFGroup', ['return' => 'id', 'name' => 'membership_batch_entry']);
+ $form->_fields = CRM_Core_BAO_UFGroup::getFields($profileID, FALSE, CRM_Core_Action::VIEW);
+
$params = $this->getMembershipData();
$this->assertTrue($form->testProcessMembership($params));
$result = $this->callAPISuccess('membership', 'get', array());
'return' => 'line_total',
)), $contribution['total_amount']);
+ $this->assertEquals(1500, $contribution['total_amount']);
$this->assertEquals($params['field'][$key]['trxn_id'], $contribution['trxn_id']);
}
}
/**
* Test Contribution Import.
+ *
+ * @param $thousandSeparator
+ *
+ * @dataProvider getThousandSeparators
*/
- public function testProcessContribution() {
+ public function testProcessContribution($thousandSeparator) {
+ $this->setCurrencySeparators($thousandSeparator);
$this->offsetDefaultPriceSet();
$form = new CRM_Batch_Form_Entry();
$params = $this->getContributionData();
'membership_end_date' => NULL,
'membership_source' => NULL,
'financial_type' => 2,
- 'total_amount' => 1,
+ 'total_amount' => $this->formatMoneyInput(1500),
'receive_date' => '2013-07-24',
'receive_date_time' => NULL,
'payment_instrument' => 1,
'membership_end_date' => NULL,
'membership_source' => NULL,
'financial_type' => 2,
- 'total_amount' => 1,
+ 'total_amount' => $this->formatMoneyInput(1500),
'receive_date' => '2013-07-17',
'receive_date_time' => NULL,
'payment_instrument' => NULL,
'membership_end_date' => '2013-12-01',
'membership_source' => NULL,
'financial_type' => 2,
- 'total_amount' => 1,
+ 'total_amount' => $this->formatMoneyInput(1500),
'receive_date' => '2013-07-17',
'receive_date_time' => NULL,
'payment_instrument' => NULL,
}
/**
+ * @param $thousandSeparator
+ *
* @return array
*/
- public function getContributionData() {
+ public function getContributionData($thousandSeparator = '.') {
return array(
//'batch_id' => 4,
'primary_profiles' => array(1 => NULL, 2 => NULL, 3 => NULL),
'field' => array(
1 => array(
'financial_type' => 1,
- 'total_amount' => 15,
+ 'total_amount' => $this->formatMoneyInput(1500.15),
'receive_date' => '2013-07-24',
'receive_date_time' => NULL,
'payment_instrument' => 1,
),
2 => array(
'financial_type' => 1,
- 'total_amount' => 15,
+ 'total_amount' => $this->formatMoneyInput(1500.15),
'receive_date' => '2013-07-24',
'receive_date_time' => NULL,
'payment_instrument' => 1,
'contribution_status_id' => 1,
),
),
- 'actualBatchTotal' => 30,
+ 'actualBatchTotal' => $this->formatMoneyInput(3000.30),
);
}