Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#26836 closed defect (bug) (fixed)

Use Mock PHPMailer during Installation for Unit Tests

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

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 13 years ago.

Download all attachments as: .zip

Change History (2)

#1 @nacin
13 years ago

  • Owner set to nacin
  • Resolution → fixed
  • Status new → closed

In 26944:

Test framework: Override PHPMailer during installation.

props bpetty.
fixes #26836.

Note: See TracTickets for help on using tickets.