-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
[Ref] Extend email trait test, process more sanely #21553
Conversation
ace6c04
to
1cf4e22
Compare
(Standard links)
|
1cf4e22
to
5c93f9c
Compare
68c534a
to
da388f9
Compare
This extracts the code used to get the from values, moves the default setting to the default and adds a test. The goal is actually to add a test on the submit function but it's proving to be challenging so this at least gets the default setting tested. Note that this code used to be on a static class, not a trait, and some stuff is in weird places - in particular stuff that should be in setDefaults and postProcess is happening on preProcess. However, most of the classes that override this trait do not do much more than call the trait so that helps at least
da388f9
to
ecb3210
Compare
$to[] = $deceasedContactID . '::' . '[email protected]'; | ||
/* @var CRM_Contact_Form_Task_Email $form*/ | ||
$form = $this->getFormObject('CRM_Contact_Form_Task_Email', [ | ||
'to' => implode(',', $to), |
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.
This is the key part of the change to this test - we are now passing 'to' as a submitted value rather than setting properties on the form (this is a good change)
Seems to run ok. I vaguely remember a previous attempt to remove toContact and it caused some problem, but maybe that was something else. |
@demeritcowboy yeah - I did try to do more on 'toContact' last time & hit issues - I think I've figured out the underlying problem now - ie because the static class was having to try to do stuff in preProcessit was insane.... A few more changes like this & it would start to be sane |
Overview
[Ref] Extend email trait test, process more sanely
Builds on #21540 which is already a bit of a crazy battle!
Before
Weird process retrieves email addresses from the submitted 'to' values in the buildForm
After
Moved to the
postProcess
- now testableTechnical Details
This is an artefact of the way the email tasks used to all pass
$form
to a static function - it would up 'doing stuff where it could' inbuildForm
not in a sane place. This now usesgetSubmittedValues
- the same could be extended to the other weird loading stuff later onComments