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

Fix test to use valid financials #20956

Merged
merged 3 commits into from
Jul 27, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Fix test to use valid financials

Before

Creates contributions and then line items, resulting in invalid financial data in the test set up

After

uses order api

Technical Details

Comments

@civibot
Copy link

civibot bot commented Jul 26, 2021

(Standard links)

*
* @var bool
*/
protected $isValidateFinancialsOnPostAssert = TRUE;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This opts in the whole class, and then we opt out the 1 test it doesn't work for

*/
protected function assertPostConditions(): void {
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 asserts are now done by the parent if $isValidateFinancialsOnPostAssert = TRUE; is true

Ideally we opt in the class & opt out specific tests as an interim. Moving
towards opt in everything & opt out specific tests
@@ -3468,8 +3468,6 @@ public function testCompleteTransactionMembershipPriceSet() {
* @throws \CiviCRM_API3_Exception
*/
public function testPendingToCompleteContribution(): void {
// @todo - figure out why this test is not valid.
$this->isValidateFinancialsOnPostAssert = FALSE;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

works because of the fix below

public function testAssignProportionalLineItems() {
public function testAssignProportionalLineItems(): void {
// This test doesn't seem to manage financials properly, possibly by design
$this->isValidateFinancialsOnPostAssert = FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this get reset for the tests that come after it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seamuslee001 yep - I just put in a break point in the next test &

image

@seamuslee001
Copy link
Contributor

This seems fine to me, just want to confirm that the postAssert is properly reset for the other tests in the ContributionTest class

@seamuslee001 seamuslee001 merged commit c3ea4bd into civicrm:master Jul 27, 2021
@seamuslee001 seamuslee001 deleted the valid_fix branch July 27, 2021 02:09
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