r73949 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73948‎ | r73949 | r73950 >
Date:15:22, 29 September 2010
Author:platonides
Status:deferred
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php
@@ -141,6 +141,7 @@
142142 $sxe = simplexml_load_string( $req->getContent() );
143143 $this->assertNotType( "bool", $sxe );
144144 $this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) );
 145+ $this->assertNotType( "null", $sxe->login[0] );
145146
146147 $a = $sxe->login[0]->attributes()->result[0];
147148 $this->assertEquals( ' result="NeedToken"', $a->asXML() );
@@ -179,6 +180,7 @@
180181 $sxe = simplexml_load_string( $req->getContent() );
181182 $this->assertNotType( "bool", $sxe );
182183 $this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) );
 184+ $this->assertNotType( "null", $sxe->login[0] );
183185
184186 $a = $sxe->login[0]->attributes()->result[0];
185187 $this->assertEquals( ' result="NeedToken"', $a->asXML() );
@@ -191,8 +193,9 @@
192194 $req->execute();
193195
194196 $cj = $req->getCookieJar();
195 - $this->assertRegexp( '/_session=[^;]*; .*UserID=[0-9]*; .*UserName=' . self::$userName . '; .*Token=/',
196 - $cj->serializeToHttpRequest( $wgScriptPath, $wgServerName ) );
 197+ $serializedCookie = $cj->serializeToHttpRequest( $wgScriptPath, $wgServerName );
 198+ $this->assertNotEquals( '', $serializedCookie );
 199+ $this->assertRegexp( '/_session=[^;]*; .*UserID=[0-9]*; .*UserName=' . self::$userName . '; .*Token=/', $serializedCookie );
197200
198201
199202 return $cj;

Status & tagging log