towards test fixes, enforce unique trxn_id from dummy payment processor. as otherwise
authorEileen McNaughton <eileen@fuzion.co.nz>
Wed, 24 Jun 2015 11:35:40 +0000 (23:35 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Wed, 24 Jun 2015 12:54:28 +0000 (00:54 +1200)
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

index ae9dd49482583586ce8b721eb99706e9b1fc0708..26ba590dae47f65de96b5e8562837e473f766111 100644 (file)
@@ -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.