X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiLoginTest.php;h=97681eb76f224f0d229c05bbe787ebefb7f13797;hb=6b3e5511fb848890f174690885e748b90389c0b8;hp=487ab84d04d0808dbc2d926984602bcb357f24b7;hpb=0f91f711b50c186210ad92a980c5c300978be670;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiLoginTest.php b/tests/phpunit/includes/api/ApiLoginTest.php index 487ab84d04..ed4d6834bc 100644 --- a/tests/phpunit/includes/api/ApiLoginTest.php +++ b/tests/phpunit/includes/api/ApiLoginTest.php @@ -1,5 +1,7 @@ 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]; @@ -188,7 +190,6 @@ class ApiLoginTest extends ApiTestCase { $this->assertArrayHasKey( "login", $data[0] ); $this->assertArrayHasKey( "result", $data[0]['login'] ); $this->assertEquals( "Success", $data[0]['login']['result'] ); - $this->assertArrayHasKey( 'lgtoken', $data[0]['login'] ); } public function testBotPassword() { @@ -231,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( @@ -255,7 +257,7 @@ class ApiLoginTest extends ApiTestCase { $ret = $this->doApiRequest( [ 'action' => 'login', 'lgname' => $lgName, - 'lgpassword' => 'foobaz', + 'lgpassword' => $password, ] ); $result = $ret[0]; @@ -270,7 +272,7 @@ class ApiLoginTest extends ApiTestCase { 'action' => 'login', 'lgtoken' => $token, 'lgname' => $lgName, - 'lgpassword' => 'foobaz', + 'lgpassword' => $password, ], $ret[2] ); $result = $ret[0];