From b0b0cc6f0e99060f7d562a89da41bdf146fe31e5 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 24 Jun 2015 23:35:40 +1200 Subject: [PATCH] towards test fixes, enforce unique trxn_id from dummy payment processor. as otherwise erwise during test runs the same one can be set twice is the first has not yet been saved to the DB --- CRM/Core/Payment/Dummy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Payment/Dummy.php b/CRM/Core/Payment/Dummy.php index ae9dd49482..26ba590dae 100644 --- a/CRM/Core/Payment/Dummy.php +++ b/CRM/Core/Payment/Dummy.php @@ -106,7 +106,7 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment { $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p)); $trxn_id = str_replace('test_', '', $trxn_id); $trxn_id = intval($trxn_id) + 1; - $params['trxn_id'] = sprintf('test_%08d', $trxn_id); + $params['trxn_id'] = 'test_' . $trxn_id . '_' . uniqid(); } else { $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'live_%'"; @@ -114,7 +114,7 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment { $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p)); $trxn_id = str_replace('live_', '', $trxn_id); $trxn_id = intval($trxn_id) + 1; - $params['trxn_id'] = sprintf('live_%08d', $trxn_id); + $params['trxn_id'] = 'live_' . $trxn_id . '_' . uniqid(); } $params['gross_amount'] = $params['amount']; // Add a fee_amount so we can make sure fees are handled properly in underlying classes. -- 2.25.1