public function testAnAccessTokenCanBeInstantiatedWhenRedirectReturnsACode()
 {
     $this->helper->instantiateSignedRequest($this->rawSignedRequestAuthorizedWithCode);
     $accessToken = $this->helper->getAccessToken();
     $this->assertInstanceOf('Facebook\\Authentication\\AccessToken', $accessToken);
     $this->assertEquals('foo_access_token_from:foo_code', $accessToken->getValue());
 }
 public function testAnAccessTokenCanBeInstantiatedWhenRedirectReturnsACode()
 {
     $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);
     $this->helper->instantiateSignedRequest($this->rawSignedRequestAuthorizedWithCode);
     $accessToken = $this->helper->getAccessToken($client);
     $this->assertInstanceOf('Facebook\\Entities\\AccessToken', $accessToken);
     $this->assertEquals('access_token_from_code', (string) $accessToken);
 }