File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -754,8 +754,9 @@ protected function _restserver($params) {
754754 $ this ->throwAPIException ($ result );
755755 }
756756
757- if ($ params ['method ' ] === 'auth.expireSession ' ||
758- $ params ['method ' ] === 'auth.revokeAuthorization ' ) {
757+ $ method = strtolower ($ params ['method ' ]);
758+ if ($ method === 'auth.expiresession ' ||
759+ $ method === 'auth.revokeauthorization ' ) {
759760 $ this ->destroySession ();
760761 }
761762
Original file line number Diff line number Diff line change @@ -1306,6 +1306,32 @@ public function testAuthExpireSessionDestroysSession() {
13061306 );
13071307 }
13081308
1309+ public function testLowercaseAuthRevokeAuthDestroysSession () {
1310+ $ methods_to_stub = array (
1311+ '_oauthRequest ' ,
1312+ 'destroySession ' ,
1313+ );
1314+ $ constructor_args = array (array (
1315+ 'appId ' => self ::APP_ID ,
1316+ 'secret ' => self ::SECRET
1317+ ));
1318+ $ key = 'foo ' ;
1319+ $ val = 42 ;
1320+ $ stub = $ this ->getMock (
1321+ 'TransientFacebook ' , $ methods_to_stub , $ constructor_args );
1322+ $ stub
1323+ ->expects ($ this ->once ())
1324+ ->method ('_oauthRequest ' )
1325+ ->will ($ this ->returnValue ("{ \"$ key \": $ val} " ));
1326+ $ stub
1327+ ->expects ($ this ->once ())
1328+ ->method ('destroySession ' );
1329+ $ this ->assertEquals (
1330+ array ($ key => $ val ),
1331+ $ stub ->api (array ('method ' => 'auth.revokeauthorization ' ))
1332+ );
1333+ }
1334+
13091335 protected function generateMD5HashOfRandomValue () {
13101336 return md5 (uniqid (mt_rand (), true ));
13111337 }
You can’t perform that action at this time.
0 commit comments