Last modified: 2013-04-22 16:14:44 UTC
When $wgEmailAuthentication is set to true, ApiCreateAccountTest::testValid() sends e-mail address confirmation mail to invalid address test@domain.test. It is very annoying to receive a "Delivery Status Notification" mail from my provider saying that the e-mail address mentioned above is invalid.
Are there any unit tests that legitimately need email to be sent? Or would it be fine to simply just add an if statement to User::sendMail to not send mail in the case of unit tests.
To easiest to me seems to remove the e-mail address from the request when creating the account; I don't like the idea to have a special case for unit tests in User or UserMailer.
OK, but then if $wgEmailConfirmToEdit is turned on, then the test just fails.
Setting 'email' => '', on line 54 works well for me.
If you give an empty email when $wgEmailConfirmToEdit is set to true, a UsageException will be thrown saying the email parameter must be set. Switching from dependence on one configuration variable to another doesn't really fix the problem.
Oh yes, I forgot about $wgEmailConfirmToEdit... In this case the easiest seems to force $wgEmailAuthentication to false so that it won't send any mail away during the tests.
(In reply to comment #6) > In this case the easiest seems to force $wgEmailAuthentication to false so > that it won't send any mail away during the tests. I've opened Bug 44206 to stub out email handling.
Gerrit change #48247
(In reply to comment #8) > Gerrit change #48247 Status Merged
reverted with https://gerrit.wikimedia.org/r/#/c/49638/
Generic solution to disable all email: https://gerrit.wikimedia.org/r/#/c/51576/
(In reply to comment #11) > Generic solution to disable all email: > https://gerrit.wikimedia.org/r/#/c/51576/ successfully merged