From: Platonides Date: Wed, 29 Sep 2010 15:22:47 +0000 (+0000) Subject: Fight PHP Fatal error: Call to a member function attributes() on a non-object X-Git-Tag: 1.31.0-rc.0~34751 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=9f48e9e96542e34c508642b47a556ff5806b7412;p=lhc%2Fweb%2Fwiklou.git Fight PHP Fatal error: Call to a member function attributes() on a non-object --- diff --git a/maintenance/tests/phpunit/includes/api/ApiTest.php b/maintenance/tests/phpunit/includes/api/ApiTest.php index 7eab2d748c..ee77c86985 100644 --- a/maintenance/tests/phpunit/includes/api/ApiTest.php +++ b/maintenance/tests/phpunit/includes/api/ApiTest.php @@ -141,6 +141,7 @@ class ApiTest extends ApiTestSetup { $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 @@ class ApiTest extends ApiTestSetup { $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 @@ class ApiTest extends ApiTestSetup { $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;