Simply test, checkPaymentResult adds no value
authoreileen <emcnaughton@wikimedia.org>
Mon, 1 Apr 2019 04:31:21 +0000 (17:31 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 1 Apr 2019 04:34:36 +0000 (17:34 +1300)
calling the checkPaymentResult function is actually decreasing readability here as the
simple array comparison is being made to look complex

tests/phpunit/api/v3/PaymentTest.php

index fbb5261cfc30e06b59aea417547ffe1f9beda267..0c49ce88f486281927f0b3cd1aede468d6c2d639 100644 (file)
@@ -197,17 +197,19 @@ class api_v3_PaymentTest extends CiviUnitTestCase {
       'contribution_id' => $contribution['id'],
       'total_amount' => -30,
       'trxn_date' => '2018-11-13 12:01:56',
-    ]);
+      'sequential' => TRUE,
+    ])['values'][0];
 
-    $this->checkPaymentResult($payment, [
-      $payment['id'] => [
-        'from_financial_account_id' => 7,
-        'to_financial_account_id' => 6,
-        'total_amount' => -30,
-        'status_id' => 1,
-        'is_payment' => 1,
-      ],
-    ]);
+    $expected = [
+      'from_financial_account_id' => 7,
+      'to_financial_account_id' => 6,
+      'total_amount' => -30,
+      'status_id' => 1,
+      'is_payment' => 1,
+    ];
+    foreach ($expected as $key => $value) {
+      $this->assertEquals($expected[$key], $payment[$key], 'mismatch on key ' . $key);
+    }
 
     $this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
     $mut->assertSubjects(['Refund Notification - Annual CiviCRM meet']);