summaryrefslogtreecommitdiff
path: root/lib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-04-26 01:00:12 +0200
committeremkael <emkael@tlen.pl>2018-04-26 01:00:12 +0200
commit4b8a9a5189a625bf99fedec7fd31f6e146410a14 (patch)
treea29759d5f0f0c29f07c89c59f6b5cf38407d1470 /lib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php
parentab82beef33f4c196383a81213dcdff4ebe9447ae (diff)
Update FB API library
Diffstat (limited to 'lib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php')
-rwxr-xr-xlib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php b/lib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php
index dec92a1..8f4e5a8 100755
--- a/lib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php
+++ b/lib/facebook-graph-sdk/tests/FacebookBatchResponseTest.php
@@ -1,6 +1,6 @@
<?php
/**
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
@@ -41,7 +41,7 @@ class FacebookBatchResponseTest extends \PHPUnit_Framework_TestCase
*/
protected $request;
- public function setUp()
+ protected function setUp()
{
$this->app = new FacebookApp('123', 'foo_secret');
$this->request = new FacebookRequest(
@@ -135,4 +135,30 @@ class FacebookBatchResponseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('foo_token_two', $batchResponse[1]->getAccessToken());
$this->assertEquals('foo_token_three', $batchResponse[2]->getAccessToken());
}
+
+ public function testHeadersFromBatchRequestCanBeAccessed()
+ {
+ $graphResponseJson = '[';
+ $graphResponseJson .= '{"code":200,"headers":[{"name":"Facebook-API-Version","value":"v2.0"},{"name":"ETag","value":"\"fooTag\""}],"body":"{\"foo\":\"bar\"}"}';
+ $graphResponseJson .= ',{"code":200,"headers":[{"name":"Facebook-API-Version","value":"v2.5"},{"name":"ETag","value":"\"barTag\""}],"body":"{\"foo\":\"bar\"}"}';
+ $graphResponseJson .= ']';
+ $response = new FacebookResponse($this->request, $graphResponseJson, 200);
+
+ $requests = [
+ new FacebookRequest($this->app, 'foo_token_one', 'GET', '/me'),
+ new FacebookRequest($this->app, 'foo_token_two', 'GET', '/you'),
+ ];
+
+ $batchRequest = new FacebookBatchRequest($this->app, $requests);
+ $batchResponse = new FacebookBatchResponse($batchRequest, $response);
+
+ $this->assertEquals('v2.0', $batchResponse[0]->getGraphVersion());
+ $this->assertEquals('"fooTag"', $batchResponse[0]->getETag());
+ $this->assertEquals('v2.5', $batchResponse[1]->getGraphVersion());
+ $this->assertEquals('"barTag"', $batchResponse[1]->getETag());
+ $this->assertEquals([
+ 'Facebook-API-Version' => 'v2.5',
+ 'ETag' => '"barTag"',
+ ], $batchResponse[1]->getHeaders());
+ }
}