http://www.mediawiki.org/wiki/Special:Code/MediaWiki/74117
Revision: 74117
Author: reedy
Date: 2010-10-01 22:27:56 +0000 (Fri, 01 Oct 2010)
Log Message:
-----------
Fixup testApiLoginBadPass per r74113, still failing, it's checking for
"NeedToken" at the end of the test, but "success" is being returned, which
seems wrong to me...
Modified Paths:
--------------
trunk/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php
Modified: trunk/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php
===================================================================
--- trunk/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php
2010-10-01 22:13:29 UTC (rev 74116)
+++ trunk/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php
2010-10-01 22:27:56 UTC (rev 74117)
@@ -90,32 +90,36 @@
if ( !isset( $wgServer ) ) {
$this->markTestIncomplete( 'This test needs $wgServer
to be set in LocalSettings.php' );
}
- $resp = Http::post( self::$apiUrl . "?action=login&format=xml",
- array( "postData" => array(
-
"lgname" => self::$userName,
-
"lgpassword" => "bad" ) ) );
- libxml_use_internal_errors( true );
- $sxe = simplexml_load_string( $resp );
- $this->assertNotType( "bool", $sxe );
- $this->assertThat( $sxe, $this->isInstanceOf(
"SimpleXMLElement" ) );
- $a = $sxe->login[0]->attributes()->result[0];
- $this->assertEquals( ' result="NeedToken"', $a->asXML() );
+ $ret = $this->doApiRequest( array(
+ "action" => "login",
+ "lgname" => self::$userName,
+ "lgpassword" => "bad",
+ )
+ );
- $token = (string)$sxe->login[0]->attributes()->token;
+ $result = $ret[0];
- $resp = Http::post( self::$apiUrl . "?action=login&format=xml",
- array( "postData" => array(
-
"lgtoken" => $token,
-
"lgname" => self::$userName,
-
"lgpassword" => "bad" ) ) );
+ $this->assertNotType( "bool", $result );
+ $a = $result["login"]["result"];
+ $this->assertEquals( "NeedToken", $a );
- $sxe = simplexml_load_string( $resp );
- $this->assertNotType( "bool", $sxe );
- $this->assertThat( $sxe, $this->isInstanceOf(
"SimpleXMLElement" ) );
- $a = $sxe->login[0]->attributes()->result[0];
+ $token = $result["login"]["token"];
- $this->assertEquals( ' result="NeedToken"', $a->asXML() );
+ $ret = $this->doApiRequest( array(
+ "action" => "login",
+ "lgtoken" => $token,
+ "lgname" => self::$userName,
+ "lgpassword" => "bad",
+ )
+ );
+
+ $result = $ret[0];
+
+ $this->assertNotType( "bool", $result );
+ $a = $result["login"]["result"];
+
+ $this->assertEquals( "NeedToken", $a );
}
function testApiLoginGoodPass() {
@@ -132,7 +136,6 @@
)
);
- libxml_use_internal_errors( true );
$result = $ret[0];
$this->assertNotType( "bool", $result );
$this->assertNotType( "null", $result["login"] );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs