compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-380: Fix unit tests after merging workstream branch with master branch #319

Closed erawat closed 3 years ago

erawat commented 3 years ago

Overview

The tests started failing when they are run against the work stream branch after it has merged with the master branch.

The reason of the test failing is that, recently the Membership Type has been refactored to provide two methods for when creating the Membership Type (API or with BAO class).

This PR is to fix unit tests related to MAE-380 as well as fix other failing tests as Payment plan form has changed in version 5 workstream.

The PR also refactors some codes, including changing method name, remove duplicate code and modify fabricator, fabricator entity for payment plan order

Before

Tests are failing when running tests after version 5 workstream branch merged with master branch.

After

Tests are passed when running tests after version 5 workstream branch merged with master branch.

Technical Details

There is a reason what worth explaining here why we would need to refactor payment plan order fabricator and its entity. Currently, payment plan order fabricator automatically set auto-renew = TRUE when fabricating a recurring contribution, recurring contribution line item.

With currently design, it is impossible to set auto-renew value when fabricating payment plan order. The reason for setting auto-renew value MembershipOfflineAutoRenewProcessor PostProcess Hook can be used and ensure that the hook is set auto-renew value correctly when the form is summited.