WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#41485 closed defect (bug) (fixed)

MockPHPMailer is not fully reset between tests

Reported by: pessoft Owned by: SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.6
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:
PR Number:

Description

phpunit tests for mail call reset_phpmailer_instance() function from mock-mailer to reset the phpmailer instance. This function currently only cleans up array of mock sent emails, but other parameters of phpmailer are kept "dirty" from previous tests. This might influence consistency of tests.

Proposed solution is to recreate the phpmailer instance fully as it is done in bootstrap.

Attachments (1)

41485.patch (520 bytes) - added by pessoft 2 years ago.
Create a new MockPHPMailer instance on reset instead just unsetting mock_sent

Download all attachments as: .zip

Change History (6)

@pessoft
2 years ago

Create a new MockPHPMailer instance on reset instead just unsetting mock_sent

#1 @pessoft
2 years ago

  • Keywords has-patch added

#2 @pessoft
2 years ago

  • Component changed from Mail to Build/Test Tools

#3 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 4.9

#4 @SergeyBiryukov
2 years ago

  • Version changed from trunk to 4.6

Introduced in [37358].

#5 @SergeyBiryukov
2 years ago

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

In 41185:

Tests: Fully reset MockPHPMailer between tests.

Props pessoft.
Fixes #41485.

Note: See TracTickets for help on using tickets.