Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FinancialTrxnTest - Fix unit test to be 'legit' #15799

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Cleans up a flawed unit test - identified in #15706

Before

Test setup results in incorrect payments created

After

Setup correct. Unhit lines of test removed.

Technical Details

This unit test is one of a bunch that came up as not creating valid payments. The issue is
in the test set up methodology (the 'partial_payment_to_pay' key doesn't work).

On tidying up the test proved to be mostly cruft from an earlier iteration

Comments

@civibot
Copy link

civibot bot commented Nov 10, 2019

(Standard links)

@@ -141,40 +148,29 @@ public function testCreateDeferredTrxn() {
'receive_date' => '2016-01-20',
'total_amount' => 622,
'financial_type_id' => 4,
'line_items' => [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are for $100 but cont total is 622 = invalid data

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL

$total = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $params['contribution_id'], 'total_amount');
$cmp = bccomp($total, $paid, 5);
// If paid amount is greater or equal to total amount
if ($cmp == 0 || $cmp == -1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never true - never hit

@totten totten changed the title Fix unit test to be 'legit' FinancialTrxnTest - Fix unit test to be 'legit' Nov 10, 2019
This unit test is one of a bunch that came up as not creating valid payments. The issue is
in the test set up methodology (the 'partial_payment_to_pay' key doesn't work).

On tidying up the test proved to be mostly cruft from an earlier iteration
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 test-only PR

@seamuslee001
Copy link
Contributor

Looks good to me

@seamuslee001 seamuslee001 merged commit e0b8c41 into civicrm:master Nov 11, 2019
@seamuslee001 seamuslee001 deleted the valid branch November 11, 2019 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants