WordPress.org

Make WordPress Core

#36658 closed enhancement (fixed)

Adding method to reset the mocked phpmailer instance

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

Description

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 15 months ago.
36658.2.diff (3.4 KB) - added by welcher 15 months ago.
Re-adding tests_ prefix

Download all attachments as: .zip

Change History (7)

@welcher
15 months ago

#1 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 4.6

#2 @boonebgorges
15 months 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?

@welcher
15 months ago

Re-adding tests_ prefix

#3 @welcher
15 months ago

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

#4 @welcher
15 months ago

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

#5 @boonebgorges
15 months 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.