(Bug 44192) Do not attempt to send a real e-mail
authorPlatonides <platonides@gmail.com>
Thu, 28 Feb 2013 22:16:29 +0000 (14:16 -0800)
committerAntoine Musso <hashar@free.fr>
Thu, 28 Feb 2013 22:17:08 +0000 (14:17 -0800)
The ApiAccountCreationTest is attempting to send an email to the newly
created user. The tests should really never send any email. This patch
register a noop callback for the 'AlternateUserMailer' hook which would
disable email entirely in our test suite.

This is generic version of 2025a89 which was only disabling mail for the
ApiAccountCreationTest test and that Antoine reverted.

Change-Id: I7b3ba4f7563a5818c988d6f8da165cc3c984f160

tests/phpunit/phpunit.php

index cce5dde..2ec0744 100755 (executable)
@@ -47,6 +47,12 @@ class PHPUnitMaintClass extends Maintenance {
                $wgLocaltimezone = 'UTC';
 
                $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
+
+               // Bug 44192 Do not attempt to send a real e-mail
+               Hooks::clear( 'AlternateUserMailer' );
+               Hooks::register( 'AlternateUserMailer',
+                       function() { return false; }
+               );
        }
 
        public function execute() {