Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Order
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jul 2018 at 07:54 UTC
Updated:
22 Apr 2020 at 10:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
s.messaris commentedHere is a patch implementing the proposed resolution.
Comment #4
s.messaris commentedComment #5
s.messaris commentedWas working in an unclean repo, this patch should apply now.
Comment #6
s.messaris commentedComment #7
simgui8 commentedI can't reproduce,
every order I have created:
-programmatically
-anonymously
-or via admin/commerce/orders/add
are themed with with my active theme template commerce-order-receipt.html.twig
Comment #8
simgui8 commentedForget about my last comment... I must have applied #5 over some leftover...
#5 fixes the receipt theme rendering when order is placed via admin interface.
thanks
Comment #9
s.messaris commentedChanging to rtbc as by #8.
Comment #10
mglamanIt's a bummer the mailsystem module doesn't have an interface we can check against.
Can we document that's why we have a method_exists?
I was perplexed why we'd check a method versus an instance. Then I realized it is because of \Drupal\mailsystem\MailsystemManager::getMailTheme.
\Drupal\mailsystem\MailsystemServiceProvider swaps the mail plugin manager.
Feel free to fix and put back to RTBC.
Comment #11
bojanz commentedHow can we write a test for this?
Comment #12
mglamanWe'd need to uhh. Add
@requires mailsystemto a test. And. I really don't know, I guess. This requires a theme having an overridden template.So we would need to:
- Provide a custom theme in the test directory
- Provide an overridden template which has some kind of custom adjustments
- Set the mailsystem to be the custom template, but the current / default template is bartik
- Send email
- Assert content has custom adjustment in template
Comment #13
lisastreeter commentedIn this patch, I've added a comment in OrderReceiptSubscriber for the method_exists() usage and written a test, as described in Matt's comment #12.
Interdiff is doing weird things when I try to create the file the correct way, so I'm attaching a "backwards" interdiff for the changes "from" patch #13 "to" patch #5. I've only added to the patch, so just read all the "-" lines as "+" lines. Sorry about that...
Comment #14
lisastreeter commentedComment #15
mglamanInstead of false, I feel like we could just do
NULL. That way we can remove$mail_theme &&checks and it's just "did this equal the returned string".Yay, we have a test! However, the test needs to be run locally and we need manual testing, anyways from subscribers of this issue.
Comment #16
bojanz commentedMissing one-line description.
Two new arguments were added to the constructor, but the docblock wasn't expanded with new @param lines.
I agree with Matt, NULL is a more natural default.
This still didn't make it clear to me. Let's do:
Nesting two long statements inside each other impacts readability for no gain. Let's do initTheme() on its own line.
I don't think we should explain PHP syntax here (why/how finally works).
Needs better description.
Class properties cannot be snake_case. And we aren't even using it in setUp(), so we don't actually need a class property.
This is repeated in both tests, we can just set order_number when constructing the order in setUp().
Comment #17
lisastreeter commentedThanks Matt and Bojan. Here is the updated patch.
Comment #18
bojanz commentedThanks, looks good now.
I need to fix this pre-commit. assertEqual() is deprecated, we need to use assertEquals() like elsewhere (and the params are reversed).
Comment #19
lisastreeter commentedOops! Missed that. Thanks for pointing it out. (And I'm always reversing the params...have to remember to double-check that whenever I write tests.)
Comment #20
lisastreeter commentedComment #21
s.messaris commentedThanks to everyone for your work on this! What else is needed to have this commited? Looks good to me.
Comment #23
bojanz commentedThanks, everyone!
Comment #25
pietermouton commentedCan this one be added in a release? I'm working on the latest dev version and I can't apply this patch with composer. (I guess because of other changes in dev).