public function testASuccessfulUrlEncodedKeyValuePairResponseWillBeDecoded() { $app = new FacebookApp('123', 'foo_secret'); $graphResponseKeyValuePairs = 'id=123&name=Foo'; $response = new FacebookResponse($app, 200, [], $graphResponseKeyValuePairs); $decodedResponse = $response->getDecodedBody(); $this->assertFalse($response->isError(), 'Did not expect Response to return an error.'); $this->assertEquals(['id' => '123', 'name' => 'Foo'], $decodedResponse); }
/** * Creates a new Response entity. * * @param FacebookResponse $response */ public function __construct(FacebookResponse $response) { $app = $response->getApp(); $httpStatusCode = $response->getHttpStatusCode(); $headers = $response->getHeaders(); $body = $response->getBody(); $accessToken = $response->getAccessToken(); parent::__construct($app, $httpStatusCode, $headers, $body, $accessToken); $responses = $response->getDecodedBody(); $this->setResponses($responses); }
/** * Init this Graph object. * * @param FacebookResponse $response The response entity from Graph. */ public function __construct(FacebookResponse $response) { $this->decodedBody = $response->getDecodedBody(); }