-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Deduplicate setting of mailSent message #12694
Conversation
(Standard links)
|
f8e1c74
to
e8ca4eb
Compare
@@ -545,6 +546,14 @@ public function testSubmit($thousandSeparator) { | |||
'Receipt text', | |||
)); | |||
$this->mut->stop(); | |||
$this->assertEquals([ | |||
[ | |||
'text' => 'AnnualFixed membership for Mr. Anthony Anderson II has been added. The new membership End Date is December 31st, ' . date('Y') . '. A membership confirmation and receipt has been sent to [email protected].', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one of those tests that will fail once a year on Dec 31?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can cope with the once a year ones - it's the once a month ones that bother me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expected behavior? That an annual membership beginning Dec 31 expires this year or next? Why not set the start date and end date in the test and avoid these quirks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - I've hard-coded the month to Feb which should keep it reliable I think - never 31 Dec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this and can confirm the membership messages still display as expected after the change. However I have a question about the test. See code comment.
e8ca4eb
to
6d5b9c6
Compare
test this please |
Overview
Minor refactor of code around setting submit status message, adds a test
Before
Code less logically grouped
After
Code more logically grouped.
Technical Details
This is a small refactor aimed at bringing code that is logically related together. There is a loop that iterates through
and creates memberships. It is an obvious candidate for extraction but it also turns out that loop builds up the $createdMemberships array for the sole purpose of setting the message for the form user. It seems fairly clear to me that every time we see
What we should really see is some variant of
Comments
#12693 contains the a superset of this change but this is intended to be legible amount