[wp-trac] [WordPress Trac] #26836: Use Mock PHPMailer during Installation for Unit Tests

WordPress Trac noreply at wordpress.org
Tue Jan 14 20:43:55 UTC 2014


#26836: Use Mock PHPMailer during Installation for Unit Tests
--------------------------+-----------------------
 Reporter:  bpetty        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.9
Component:  Unit Tests    |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26836>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list