http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73949

Revision: 73949
Author:   platonides
Date:     2010-09-29 15:22:47 +0000 (Wed, 29 Sep 2010)

Log Message:
-----------
Fight PHP Fatal error:  Call to a member function attributes() on a non-object

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-09-29 15:14:39 UTC (rev 73948)
+++ trunk/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php     
2010-09-29 15:22:47 UTC (rev 73949)
@@ -141,6 +141,7 @@
                $sxe = simplexml_load_string( $req->getContent() );
                $this->assertNotType( "bool", $sxe );
                $this->assertThat( $sxe, $this->isInstanceOf( 
"SimpleXMLElement" ) );
+               $this->assertNotType( "null", $sxe->login[0] );
 
                $a = $sxe->login[0]->attributes()->result[0];
                $this->assertEquals( ' result="NeedToken"', $a->asXML() );
@@ -179,6 +180,7 @@
                $sxe = simplexml_load_string( $req->getContent() );
                $this->assertNotType( "bool", $sxe );
                $this->assertThat( $sxe, $this->isInstanceOf( 
"SimpleXMLElement" ) );
+               $this->assertNotType( "null", $sxe->login[0] );
 
                $a = $sxe->login[0]->attributes()->result[0];
                $this->assertEquals( ' result="NeedToken"', $a->asXML() );
@@ -191,8 +193,9 @@
                $req->execute();
 
                $cj = $req->getCookieJar();
-               $this->assertRegexp( '/_session=[^;]*; .*UserID=[0-9]*; 
.*UserName=' . self::$userName . '; .*Token=/',
-                                                        
$cj->serializeToHttpRequest( $wgScriptPath, $wgServerName ) );
+               $serializedCookie = $cj->serializeToHttpRequest( $wgScriptPath, 
$wgServerName );
+               $this->assertNotEquals( '', $serializedCookie );
+               $this->assertRegexp( '/_session=[^;]*; .*UserID=[0-9]*; 
.*UserName=' . self::$userName . '; .*Token=/', $serializedCookie );
 
 
                return $cj;



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to