From: eileen Date: Mon, 11 Feb 2019 03:54:14 +0000 (+1300) Subject: Minor readability cleanup X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2c9c33f5da4b05fb8e4763f62790fef3429932b5;p=civicrm-core.git Minor readability cleanup --- diff --git a/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php b/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php index a062e726d6..8c05c65f9b 100644 --- a/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php +++ b/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php @@ -40,20 +40,7 @@ class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase { public function tearDown() { $this->eventDelete($this->_eventId); - $this->quickCleanup( - array( - 'civicrm_contact', - 'civicrm_contribution', - 'civicrm_participant', - 'civicrm_participant_payment', - 'civicrm_line_item', - 'civicrm_financial_item', - 'civicrm_financial_trxn', - 'civicrm_price_set', - 'civicrm_entity_financial_trxn', - ), - TRUE - ); + $this->quickCleanUpFinancialEntities(); } /** @@ -165,10 +152,9 @@ class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase { ] ); $contributionID = $result['contribution']['id']; - extract($result); // check payment info - $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($participant['id'], 'event'); + $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($result['participant']['id'], 'event'); $this->assertEquals(round($paymentInfo['total']), $feeAmt, 'Total amount recorded is not proper'); $this->assertEquals(round($paymentInfo['paid']), $amtPaid, 'Amount paid is not proper'); $this->assertEquals(round($paymentInfo['balance']), $feeAmt, 'Balance amount is not proper'); @@ -190,7 +176,7 @@ class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase { $form->testSubmit($submitParams); // check payment info again and see if the payment is completed - $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($participant['id'], 'event'); + $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($result['participant']['id'], 'event'); $this->assertEquals(round($paymentInfo['total']), $feeAmt, 'Total amount recorded is not proper'); $this->assertEquals(round($paymentInfo['paid']), $feeAmt, 'Amount paid is not proper'); $this->assertEquals(round($paymentInfo['balance']), 0, 'Balance amount is not proper'); @@ -227,23 +213,22 @@ class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase { $amtPaid = 80; $result = $this->addParticipantWithPayment($feeAmt, $amtPaid); $contributionID = $result['contribution']['id']; - extract($result); //Complete the partial payment. $submittedValues = array( 'total_amount' => 20, 'payment_instrument_id' => 3, ); - CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'owed', $participant['id']); + CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'owed', $result['participant']['id']); //Change selection to a lower amount. $params['price_2'] = 50; - CRM_Price_BAO_LineItem::changeFeeSelections($params, $participant['id'], 'participant', $contributionID, $feeBlock, $lineItem, $feeAmt); + CRM_Price_BAO_LineItem::changeFeeSelections($params, $result['participant']['id'], 'participant', $contributionID, $result['feeBlock'], $result['lineItem']); //Record a refund of the remaining amount. $submittedValues['total_amount'] = 50; - CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'refund', $participant['id']); - $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($participant['id'], 'event', TRUE); + CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'refund', $result['participant']['id']); + $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($result['participant']['id'], 'event', TRUE); $transaction = $paymentInfo['transaction']; //Assert all transaction(owed and refund) are listed on view payments.