public function testLoggedOutCanvasSession()
 {
     $helper = new FacebookCanvasLoginHelper();
     $signedRequest = FacebookSessionTest::makeSignedRequest(array('ship' => 'love'));
     $_GET['signed_request'] = $signedRequest;
     $this->assertNull($helper->getSession());
 }
コード例 #2
0
 public function testGetSessionFromCanvasPOST()
 {
     $helper = new FacebookCanvasLoginHelper();
     $signedRequest = FacebookSessionTest::makeSignedRequest(array('oauth_token' => 'token'));
     $_POST['signed_request'] = $signedRequest;
     $session = $helper->getSession();
     $this->assertTrue($session instanceof FacebookSession);
     $this->assertTrue($session->getToken() == 'token');
 }
 public function testGetSessionFromCookie()
 {
     $helper = new FacebookJavaScriptLoginHelper(FacebookTestCredentials::$appId);
     $signedRequest = FacebookSessionTest::makeSignedRequest(array('oauth_token' => 'token'));
     $_COOKIE['fbsr_' . FacebookTestCredentials::$appId] = $signedRequest;
     $session = $helper->getSession();
     $this->assertTrue($session instanceof FacebookSession);
     $this->assertTrue($session->getToken() == 'token');
 }
 public function testLoggedOutPageTab()
 {
     $signedRequest = FacebookSessionTest::makeSignedRequest(array('page' => array('liked' => 'false', 'admin' => 'true', 'id' => 42)));
     $_POST['signed_request'] = $signedRequest;
     $helper = new FacebookPageTabHelper();
     $session = $helper->getSession();
     $this->assertNull($session);
     $this->assertFalse($helper->isLiked());
     $this->assertTrue($helper->isAdmin());
     $this->assertEquals(42, $helper->getPageId());
 }