'wsTokenSecrets' => [ 'login' => 'foobar' ],
];
$data = $this->doApiRequest( [ 'action' => 'login',
- 'lgname' => '', 'lgpassword' => self::$users['sysop']->password,
+ 'lgname' => '', 'lgpassword' => self::$users['sysop']->getPassword(),
'lgtoken' => (string)( new MediaWiki\Session\Token( 'foobar', '' ) )
], $session );
$this->assertEquals( $wgDisableAuthManager ? 'NoName' : 'Failed', $data[0]['login']['result'] );
global $wgServer, $wgDisableAuthManager;
$user = self::$users['sysop'];
+ $userName = $user->getUser()->getName();
$user->getUser()->logout();
if ( !isset( $wgServer ) ) {
}
$ret = $this->doApiRequest( [
"action" => "login",
- "lgname" => $user->username,
+ "lgname" => $userName,
"lgpassword" => "bad",
] );
[
"action" => "login",
"lgtoken" => $token,
- "lgname" => $user->username,
+ "lgname" => $userName,
"lgpassword" => "badnowayinhell",
],
$ret[2]
}
$user = self::$users['sysop'];
+ $userName = $user->getUser()->getName();
+ $password = $user->getPassword();
$user->getUser()->logout();
$ret = $this->doApiRequest( [
"action" => "login",
- "lgname" => $user->username,
- "lgpassword" => $user->password,
+ "lgname" => $userName,
+ "lgpassword" => $password,
]
);
[
"action" => "login",
"lgtoken" => $token,
- "lgname" => $user->username,
- "lgpassword" => $user->password,
+ "lgname" => $userName,
+ "lgpassword" => $password,
],
$ret[2]
);
$this->markTestIncomplete( 'This test needs $wgServer to be set in LocalSettings.php' );
}
$user = self::$users['sysop'];
+ $userName = $user->getUser()->getName();
+ $password = $user->getPassword();
$req = MWHttpRequest::factory( self::$apiUrl . "?action=login&format=xml",
[ "method" => "POST",
"postData" => [
- "lgname" => $user->username,
- "lgpassword" => $user->password
+ "lgname" => $userName,
+ "lgpassword" => $password
]
],
__METHOD__
$req->setData( [
"lgtoken" => $token,
- "lgname" => $user->username,
- "lgpassword" => $user->password ] );
+ "lgname" => $userName,
+ "lgpassword" => $password ] );
$req->execute();
$cj = $req->getCookieJar();
}
public function testRunLogin() {
- $sysopUser = self::$users['sysop'];
+ $user = self::$users['sysop'];
+ $userName = $user->getUser()->getName();
+ $password = $user->getPassword();
+
$data = $this->doApiRequest( [
'action' => 'login',
- 'lgname' => $sysopUser->username,
- 'lgpassword' => $sysopUser->password ] );
+ 'lgname' => $userName,
+ 'lgpassword' => $password ] );
$this->assertArrayHasKey( "login", $data[0] );
$this->assertArrayHasKey( "result", $data[0]['login'] );
$data = $this->doApiRequest( [
'action' => 'login',
"lgtoken" => $token,
- "lgname" => $sysopUser->username,
- "lgpassword" => $sysopUser->password ], $data[2] );
+ "lgname" => $userName,
+ "lgpassword" => $password ], $data[2] );
$this->assertArrayHasKey( "login", $data[0] );
$this->assertArrayHasKey( "result", $data[0]['login'] );
__METHOD__
);
- $lgName = $user->username . BotPassword::getSeparator() . 'foo';
+ $lgName = $user->getUser()->getName() . BotPassword::getSeparator() . 'foo';
$ret = $this->doApiRequest( [
'action' => 'login',