jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/378652 )

Change subject: user: Unregister hooks that interfere with unit testing
......................................................................


user: Unregister hooks that interfere with unit testing

testExecute_email() should unregister the hooks
mailPasswordInternal and SpecialPasswordResetOnSubmit
for proper unit testing.

Bug: T176102
Change-Id: Id7403f57cc9d751ada85b611193c1d8f3503e713
---
M tests/phpunit/includes/user/PasswordResetTest.php
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/includes/user/PasswordResetTest.php 
b/tests/phpunit/includes/user/PasswordResetTest.php
index 53f02df..feae26a 100644
--- a/tests/phpunit/includes/user/PasswordResetTest.php
+++ b/tests/phpunit/includes/user/PasswordResetTest.php
@@ -5,7 +5,7 @@
 /**
  * @group Database
  */
-class PasswordResetTest extends PHPUnit_Framework_TestCase {
+class PasswordResetTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideIsAllowed
         */
@@ -150,6 +150,12 @@
                        'EnableEmail' => true,
                ] );
 
+               // Unregister the hooks for proper unit testing
+               $this->mergeMwGlobalArrayValue( 'wgHooks', [
+                       'mailPasswordInternal' => [],
+                       'SpecialPasswordResetOnSubmit' => [],
+               ] );
+
                $authManager = $this->getMockBuilder( AuthManager::class 
)->disableOriginalConstructor()
                        ->getMock();
                $authManager->expects( $this->any() )->method( 
'allowsAuthenticationDataChange' )

-- 
To view, visit https://gerrit.wikimedia.org/r/378652
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id7403f57cc9d751ada85b611193c1d8f3503e713
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Huji <huji.h...@gmail.com>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Huji <huji.h...@gmail.com>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to