Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#36658 closed enhancement (fixed)

Adding method to reset the mocked phpmailer instance

Reported by: welcher's profile welcher Owned by: boonebgorges's profile boonebgorges
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch dev-feedback
Focuses: Cc:


Added a new decorator method to rest the mock phpmailer object to make it more clear as to what the code is doing. Also, I removed the tests_ prefix from the retrieve_phpmailer_instance method as it is not needed and may cause confusion as it does not contain any tests.

Attachments (2)

36658.diff (7.6 KB) - added by welcher 8 years ago.
36658.2.diff (3.4 KB) - added by welcher 8 years ago.
Re-adding tests_ prefix

Download all attachments as: .zip

Change History (7)

8 years ago

#1 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 4.6

#2 @boonebgorges
8 years ago

  • Keywords needs-patch added; has-patch dev-feedback removed

The reset method looks good to me.

I think the tests_ prefix on the function is meant to be a namespace - see tests_add_filter(). I am wary of changing it just for aesthetic reasons, as there may be third-party libraries using it. Could you change it back and post an updated patch?

8 years ago

Re-adding tests_ prefix

#3 @welcher
8 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed

#4 @welcher
8 years ago

@boonebgorges I've added the tests_ prefix back in.

#5 @boonebgorges
8 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 37358:

Tests: Introduce reset_phpmailer_instance() function.

This function provides a more convenient method for resetting the
PHPMailer instance than the previous technique of reaching into the global.

Props welcher.
Fixes #36658.

Note: See TracTickets for help on using tickets.