Merge "Get ConfigFactory & MainConfig from MediaWikiServices"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 24 Nov 2016 18:08:36 +0000 (18:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 24 Nov 2016 18:08:36 +0000 (18:08 +0000)
1  2 
includes/auth/TemporaryPasswordAuthenticationRequest.php
tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php

@@@ -21,6 -21,8 +21,8 @@@
  
  namespace MediaWiki\Auth;
  
+ use MediaWiki\MediaWikiServices;
  /**
   * This represents the intention to set a temporary password for the user.
   * @ingroup Auth
@@@ -33,6 -35,12 +35,6 @@@ class TemporaryPasswordAuthenticationRe
        /** @var bool Email password to the user. */
        public $mailpassword = false;
  
 -      /**
 -       * @var bool Do not fail certain operations if the password cannot be mailed, there is a
 -       *   backchannel present.
 -       */
 -      public $hasBackchannel = false;
 -
        /** @var string Username or IP address of the caller */
        public $caller;
  
@@@ -61,7 -69,7 +63,7 @@@
         * @return TemporaryPasswordAuthenticationRequest
         */
        public static function newRandom() {
-               $config = \ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
+               $config = MediaWikiServices::getInstance()->getMainConfig();
  
                // get the min password length
                $minLength = $config->get( 'MinimalPasswordLength' );
@@@ -2,6 -2,7 +2,7 @@@
  
  namespace MediaWiki\Auth;
  
+ use MediaWiki\MediaWikiServices;
  use Wikimedia\ScopedCallback;
  
  /**
@@@ -32,7 -33,7 +33,7 @@@ class TemporaryPasswordPrimaryAuthentic
                }
                $config = new \MultiConfig( [
                        $this->config,
-                       \ConfigFactory::getDefaultInstance()->makeConfig( 'main' )
+                       MediaWikiServices::getInstance()->getMainConfig()
                ] );
  
                if ( !$this->manager ) {
                $provider = $this->getProvider( [ 'emailEnabled' => false ] );
                $status = $provider->providerAllowsAuthenticationDataChange( $req, true );
                $this->assertEquals( \StatusValue::newFatal( 'passwordreset-emaildisabled' ), $status );
 -              $req->hasBackchannel = true;
 -              $status = $provider->providerAllowsAuthenticationDataChange( $req, true );
 -              $this->assertFalse( $status->hasMessage( 'passwordreset-emaildisabled' ) );
 -              $req->hasBackchannel = false;
  
                $provider = $this->getProvider( [ 'passwordReminderResendTime' => 10 ] );
                $status = $provider->providerAllowsAuthenticationDataChange( $req, true );
                $provider = $this->getProvider( [ 'emailEnabled' => false ] );
                $status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
                $this->assertEquals( \StatusValue::newFatal( 'emaildisabled' ), $status );
 -              $req->hasBackchannel = true;
 -              $status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
 -              $this->assertFalse( $status->hasMessage( 'emaildisabled' ) );
 -              $req->hasBackchannel = false;
  
                $provider = $this->getProvider( [ 'emailEnabled' => true ] );
                $status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
                $this->assertEquals( \StatusValue::newFatal( 'noemailcreate' ), $status );
 -              $req->hasBackchannel = true;
 -              $status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
 -              $this->assertFalse( $status->hasMessage( 'noemailcreate' ) );
 -              $req->hasBackchannel = false;
  
                $user->setEmail( 'test@localhost.localdomain' );
                $status = $provider->testForAccountCreation( $user, $creator, [ $req ] );