Skip to content

Commit 27e959b

Browse files
committed
Add test for FacebookBatchRequest factory method
1 parent eeab858 commit 27e959b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/FacebookTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,28 @@ public function testCreatingANewRequestWillDefaultToTheProperConfig()
304304
);
305305
}
306306

307+
public function testCreatingANewBatchRequestWillDefaultToTheProperConfig()
308+
{
309+
$config = array_merge($this->config, [
310+
'default_access_token' => 'foo_token',
311+
'enable_beta_mode' => true,
312+
'default_graph_version' => 'v1337',
313+
]);
314+
$fb = new Facebook($config);
315+
316+
$batchRequest = $fb->newBatchRequest();
317+
$this->assertEquals('1337', $batchRequest->getApp()->getId());
318+
$this->assertEquals('foo_secret', $batchRequest->getApp()->getSecret());
319+
$this->assertEquals('foo_token', (string)$batchRequest->getAccessToken());
320+
$this->assertEquals('v1337', $batchRequest->getGraphVersion());
321+
$this->assertEquals(
322+
FacebookClient::BASE_GRAPH_URL_BETA,
323+
$fb->getClient()->getBaseGraphUrl()
324+
);
325+
$this->assertInstanceOf('Facebook\FacebookBatchRequest', $batchRequest);
326+
$this->assertEquals(0, count($batchRequest->getRequests()));
327+
}
328+
307329
public function testCanInjectCustomHandlers()
308330
{
309331
$config = array_merge($this->config, [

0 commit comments

Comments
 (0)