X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiLoginTest.php;h=97681eb76f224f0d229c05bbe787ebefb7f13797;hb=6b3e5511fb848890f174690885e748b90389c0b8;hp=917a6adaffd4242a5f9904c43f906dc68179864d;hpb=23e5cdb5034dca5bbdfc2ac9c111c5fac20ff579;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiLoginTest.php b/tests/phpunit/includes/api/ApiLoginTest.php index 917a6adaff..ed4d6834bc 100644 --- a/tests/phpunit/includes/api/ApiLoginTest.php +++ b/tests/phpunit/includes/api/ApiLoginTest.php @@ -1,5 +1,7 @@ [ 'login' => 'foobar' ], ]; @@ -22,11 +22,11 @@ class ApiLoginTest extends ApiTestCase { 'lgname' => '', 'lgpassword' => self::$users['sysop']->getPassword(), 'lgtoken' => (string)( new MediaWiki\Session\Token( 'foobar', '' ) ) ], $session ); - $this->assertEquals( $wgDisableAuthManager ? 'NoName' : 'Failed', $data[0]['login']['result'] ); + $this->assertEquals( 'Failed', $data[0]['login']['result'] ); } public function testApiLoginBadPass() { - global $wgServer, $wgDisableAuthManager; + global $wgServer; $user = self::$users['sysop']; $userName = $user->getUser()->getName(); @@ -64,7 +64,7 @@ class ApiLoginTest extends ApiTestCase { $this->assertNotInternalType( "bool", $result ); $a = $result["login"]["result"]; - $this->assertEquals( $wgDisableAuthManager ? 'WrongPass' : 'Failed', $a ); + $this->assertEquals( 'Failed', $a ); } public function testApiLoginGoodPass() { @@ -142,7 +142,7 @@ class ApiLoginTest extends ApiTestCase { libxml_use_internal_errors( true ); $sxe = simplexml_load_string( $req->getContent() ); $this->assertNotInternalType( "bool", $sxe ); - $this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) ); + $this->assertThat( $sxe, $this->isInstanceOf( SimpleXMLElement::class ) ); $this->assertNotInternalType( "null", $sxe->login[0] ); $a = $sxe->login[0]->attributes()->result[0]; @@ -232,10 +232,11 @@ class ApiLoginTest extends ApiTestCase { $centralId = CentralIdLookup::factory()->centralIdFromLocalUser( $user->getUser() ); $this->assertNotEquals( 0, $centralId, 'sanity check' ); + $password = 'ngfhmjm64hv0854493hsj5nncjud2clk'; $passwordFactory = new PasswordFactory(); $passwordFactory->init( RequestContext::getMain()->getConfig() ); // A is unsalted MD5 (thus fast) ... we don't care about security here, this is test only - $passwordHash = $passwordFactory->newFromPlaintext( 'foobaz' ); + $passwordHash = $passwordFactory->newFromPlaintext( $password ); $dbw = wfGetDB( DB_MASTER ); $dbw->insert( @@ -256,7 +257,7 @@ class ApiLoginTest extends ApiTestCase { $ret = $this->doApiRequest( [ 'action' => 'login', 'lgname' => $lgName, - 'lgpassword' => 'foobaz', + 'lgpassword' => $password, ] ); $result = $ret[0]; @@ -271,7 +272,7 @@ class ApiLoginTest extends ApiTestCase { 'action' => 'login', 'lgtoken' => $token, 'lgname' => $lgName, - 'lgpassword' => 'foobaz', + 'lgpassword' => $password, ], $ret[2] ); $result = $ret[0];