Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#26836 closed defect (bug) (fixed)

Use Mock PHPMailer during Installation for Unit Tests

Reported by: bpetty's profile bpetty Owned by: nacin's profile nacin
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: Unit Tests Keywords: has-patch
Focuses: Cc:

Description

We install the mock PHPMailer class for use during unit tests, however, it's not currently used during bootstrap installation since this is done in a separate process.

Not doing this can result in mailer exceptions in environments that aren't properly configured for sending mail even though we don't want to actually send any during tests. This is the case on Travis CI for example, and is currently one more reason why AJAX unit tests fail (since they perform an installation during some tests that are marked for @runTestsInSeparateProcesses.

The solution is simple, we already have a custom install script for bootstrapping tests, and we just need to inject the mock mailer there in the same way we do in bootstrap.php for the tests that aren't run in a separate process, see the attached patch.

Attachments (1)

ticket-26836-tests-mock-mailer.patch (593 bytes) - added by bpetty 11 years ago.

Download all attachments as: .zip

Change History (2)

#1 @nacin
11 years ago

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

In 26944:

Test framework: Override PHPMailer during installation.

props bpetty.
fixes #26836.

Note: See TracTickets for help on using tickets.