Fix mock test data for PaymentProcessor object.
authoreileen <emcnaughton@wikimedia.org>
Thu, 18 Jan 2018 05:54:21 +0000 (18:54 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 18 Jan 2018 05:54:21 +0000 (18:54 +1300)
This only affects unit tests. When dummy data is generated for a PaymentProcessor it will be more
usable

CRM/Financial/BAO/PaymentProcessor.php

index f318aaacfd90ff1fad07f85f98004073e5883aa4..cf54a3b52dead1ff63a5b8cde017dd8ddaa84a81 100644 (file)
@@ -565,4 +565,21 @@ INNER JOIN civicrm_contribution       con ON ( mp.contribution_id = con.id )
     return Civi\Payment\System::singleton()->getById($paymentProcessorId);
   }
 
+  /**
+   * Generate and assign an arbitrary value to a field of a test object.
+   *
+   * @param string $fieldName
+   * @param array $fieldDef
+   * @param int $counter
+   *   The globally-unique ID of the test object.
+   */
+  protected function assignTestValue($fieldName, &$fieldDef, $counter) {
+    if ($fieldName === 'class_name') {
+      $this->class_name = 'Payment_Dummy';
+    }
+    else {
+      parent::assignTestValue($fieldName, $fieldDef, $counter);
+    }
+  }
+
 }