public function testAnAccessTokenCanBeObtainedFromRedirect()
 {
     $this->persistentDataHandler->set('state', 'foo_state');
     $_GET['state'] = 'foo_state';
     $_GET['code'] = 'foo_code';
     $response = m::mock('Facebook\\Entities\\FacebookResponse');
     $response->shouldReceive('getDecodedBody')->once()->andReturn(['access_token' => 'access_token_from_code', 'expires' => 555]);
     $client = m::mock('Facebook\\FacebookClient');
     $client->shouldReceive('sendRequest')->with(m::type('Facebook\\Entities\\FacebookRequest'))->once()->andReturn($response);
     $app = new FacebookApp('123', 'foo_app_secret');
     $helper = new FacebookRedirectLoginHelper($app, $this->persistentDataHandler);
     $accessToken = $helper->getAccessToken($client, self::REDIRECT_URL);
     $this->assertInstanceOf('Facebook\\Entities\\AccessToken', $accessToken);
     $this->assertEquals('access_token_from_code', (string) $accessToken);
 }
 public function testCanGetAndSetAVirtualValue()
 {
     $handler = new FacebookMemoryPersistentDataHandler();
     $handler->set('foo', 'bar');
     $value = $handler->get('foo');
     $this->assertEquals('bar', $value);
 }