public function testGraphAPIWithSession() { $facebook = new Facebook(array('appId' => self::APP_ID, 'secret' => self::SECRET)); $facebook->setSession(self::$VALID_EXPIRED_SESSION); try { $response = $facebook->api('/me'); $this->fail('Should not get here.'); } catch (FacebookApiException $e) { // means the server got the access token $msg = 'OAuthException: Error processing access token.'; $this->assertEquals((string) $e, $msg, 'Expect the invalid session message.'); // also ensure the session was reset since it was invalid $this->assertEquals($facebook->getSession(), null, 'Expect the to be reset.'); } }
/** * Kills the current Facebook session */ public function doLogoutFbUser() { // set the current session to null $this->facebook->setSession(null); }