summaryrefslogtreecommitdiff
path: root/lib/facebook-graph-sdk/tests/FacebookClientTest.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/FacebookClientTest.php
parentab82beef33f4c196383a81213dcdff4ebe9447ae (diff)
Update FB API library
Diffstat (limited to 'lib/facebook-graph-sdk/tests/FacebookClientTest.php')
-rw-r--r--lib/facebook-graph-sdk/tests/FacebookClientTest.php40
1 files changed, 13 insertions, 27 deletions
diff --git a/lib/facebook-graph-sdk/tests/FacebookClientTest.php b/lib/facebook-graph-sdk/tests/FacebookClientTest.php
index 6e9bb6c..9a08fb6 100644
--- a/lib/facebook-graph-sdk/tests/FacebookClientTest.php
+++ b/lib/facebook-graph-sdk/tests/FacebookClientTest.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
@@ -29,36 +29,14 @@ use Facebook\FacebookApp;
use Facebook\FacebookRequest;
use Facebook\FacebookBatchRequest;
use Facebook\FacebookClient;
-use Facebook\Http\GraphRawResponse;
-use Facebook\HttpClients\FacebookHttpClientInterface;
use Facebook\FileUpload\FacebookFile;
use Facebook\FileUpload\FacebookVideo;
// These are needed when you uncomment the HTTP clients below.
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\HttpClients\FacebookGuzzleHttpClient;
use Facebook\HttpClients\FacebookStreamHttpClient;
-
-class MyFooClientHandler implements FacebookHttpClientInterface
-{
- public function send($url, $method, $body, array $headers, $timeOut)
- {
- return new GraphRawResponse(
- "HTTP/1.1 200 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT",
- '{"data":[{"id":"123","name":"Foo"},{"id":"1337","name":"Bar"}]}'
- );
- }
-}
-
-class MyFooBatchClientHandler implements FacebookHttpClientInterface
-{
- public function send($url, $method, $body, array $headers, $timeOut)
- {
- return new GraphRawResponse(
- "HTTP/1.1 200 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT",
- '[{"code":"123","body":"Foo"},{"code":"1337","body":"Bar"}]'
- );
- }
-}
+use Facebook\Tests\Fixtures\MyFooBatchClientHandler;
+use Facebook\Tests\Fixtures\MyFooClientHandler;
class FacebookClientTest extends \PHPUnit_Framework_TestCase
{
@@ -82,7 +60,7 @@ class FacebookClientTest extends \PHPUnit_Framework_TestCase
*/
public static $testFacebookClient;
- public function setUp()
+ protected function setUp()
{
$this->fbApp = new FacebookApp('id', 'shhhh!');
$this->fbClient = new FacebookClient(new MyFooClientHandler());
@@ -94,7 +72,7 @@ class FacebookClientTest extends \PHPUnit_Framework_TestCase
$client = new FacebookClient($handler);
$httpHandler = $client->getHttpClientHandler();
- $this->assertInstanceOf('Facebook\Tests\MyFooClientHandler', $httpHandler);
+ $this->assertInstanceOf('Facebook\Tests\Fixtures\MyFooClientHandler', $httpHandler);
}
public function testTheHttpClientWillFallbackToDefault()
@@ -218,6 +196,14 @@ class FacebookClientTest extends \PHPUnit_Framework_TestCase
$this->assertContains('multipart/form-data; boundary=', $headersSent['Content-Type']);
}
+ public function testAFacebookRequestValidatesTheAccessTokenWhenOneIsNotProvided()
+ {
+ $this->setExpectedException('Facebook\Exceptions\FacebookSDKException');
+
+ $fbRequest = new FacebookRequest($this->fbApp, null, 'GET', '/foo');
+ $this->fbClient->sendRequest($fbRequest);
+ }
+
/**
* @group integration
*/