@@ -23,11 +23,11 @@ |
||
23 | 23 | */ |
24 | 24 | date_default_timezone_set('Europe/Paris'); |
25 | 25 | |
26 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
26 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
27 | 27 | |
28 | 28 | use Facebook\FacebookClient; |
29 | 29 | |
30 | 30 | // Delete the temp test user after all tests have fired |
31 | -register_shutdown_function(function () { |
|
31 | +register_shutdown_function(function() { |
|
32 | 32 | //echo "\nTotal requests made to Graph: " . FacebookClient::$requestCount . "\n\n"; |
33 | 33 | }); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | [ |
225 | 225 | 'headers' => $headers, |
226 | 226 | 'method' => 'GET', |
227 | - 'relative_url' => '/' . $apiVersion . '/foo?foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
227 | + 'relative_url' => '/'.$apiVersion.'/foo?foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
228 | 228 | 'name' => 'foo_name', |
229 | 229 | ], |
230 | 230 | ], |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | [ |
234 | 234 | 'headers' => $headers, |
235 | 235 | 'method' => 'POST', |
236 | - 'relative_url' => '/' . $apiVersion . '/bar', |
|
236 | + 'relative_url' => '/'.$apiVersion.'/bar', |
|
237 | 237 | 'body' => 'bar=baz&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
238 | 238 | 'name' => 'foo_name', |
239 | 239 | ], |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | [ |
244 | 244 | 'headers' => $headers, |
245 | 245 | 'method' => 'DELETE', |
246 | - 'relative_url' => '/' . $apiVersion . '/bar?access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
246 | + 'relative_url' => '/'.$apiVersion.'/bar?access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
247 | 247 | 'name' => 'foo_name', |
248 | 248 | ], |
249 | 249 | ], |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | { |
255 | 255 | $request = new FacebookRequest(null, null, 'POST', '/bar', [ |
256 | 256 | 'message' => 'foobar', |
257 | - 'source' => new FacebookFile(__DIR__ . '/foo.txt'), |
|
257 | + 'source' => new FacebookFile(__DIR__.'/foo.txt'), |
|
258 | 258 | ]); |
259 | 259 | |
260 | 260 | $batchRequest = $this->createBatchRequest(); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $this->assertEquals([ |
274 | 274 | 'headers' => $this->defaultHeaders(), |
275 | 275 | 'method' => 'POST', |
276 | - 'relative_url' => '/' . Facebook::DEFAULT_GRAPH_VERSION . '/bar', |
|
276 | + 'relative_url' => '/'.Facebook::DEFAULT_GRAPH_VERSION.'/bar', |
|
277 | 277 | 'body' => 'message=foobar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
278 | 278 | 'name' => 'foo_name', |
279 | 279 | 'attached_files' => $attachedFiles, |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | $expectedHeaders = json_encode($this->defaultHeaders()); |
293 | 293 | $version = Facebook::DEFAULT_GRAPH_VERSION; |
294 | 294 | $expectedBatchParams = [ |
295 | - 'batch' => '[{"headers":' . $expectedHeaders . ',"method":"GET","relative_url":"\\/' . $version . '\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
296 | - . '{"headers":' . $expectedHeaders . ',"method":"POST","relative_url":"\\/' . $version . '\\/bar","body":"foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9"}]', |
|
295 | + 'batch' => '[{"headers":'.$expectedHeaders.',"method":"GET","relative_url":"\\/'.$version.'\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
296 | + . '{"headers":'.$expectedHeaders.',"method":"POST","relative_url":"\\/'.$version.'\\/bar","body":"foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9"}]', |
|
297 | 297 | 'include_headers' => true, |
298 | 298 | 'access_token' => 'foo_token', |
299 | 299 | 'appsecret_proof' => 'df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $batchRequest->add(new FacebookRequest(null, 'bar_token', 'GET', '/foo'), 'foo_name'); |
308 | 308 | $batchRequest->add(new FacebookRequest(null, null, 'POST', '/me/photos', [ |
309 | 309 | 'message' => 'foobar', |
310 | - 'source' => new FacebookFile(__DIR__ . '/foo.txt'), |
|
310 | + 'source' => new FacebookFile(__DIR__.'/foo.txt'), |
|
311 | 311 | ])); |
312 | 312 | $batchRequest->prepareRequestsForBatch(); |
313 | 313 | |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | $expectedHeaders = json_encode($this->defaultHeaders()); |
320 | 320 | $version = Facebook::DEFAULT_GRAPH_VERSION; |
321 | 321 | $expectedBatchParams = [ |
322 | - 'batch' => '[{"headers":' . $expectedHeaders . ',"method":"GET","relative_url":"\\/' . $version . '\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
323 | - . '{"headers":' . $expectedHeaders . ',"method":"POST","relative_url":"\\/' . $version . '\\/me\\/photos","body":"message=foobar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9","attached_files":"' . $attachedFiles . '"}]', |
|
322 | + 'batch' => '[{"headers":'.$expectedHeaders.',"method":"GET","relative_url":"\\/'.$version.'\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
323 | + . '{"headers":'.$expectedHeaders.',"method":"POST","relative_url":"\\/'.$version.'\\/me\\/photos","body":"message=foobar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9","attached_files":"'.$attachedFiles.'"}]', |
|
324 | 324 | 'include_headers' => true, |
325 | 325 | 'access_token' => 'foo_token', |
326 | 326 | 'appsecret_proof' => 'df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | { |
342 | 342 | $headers = []; |
343 | 343 | foreach (FacebookRequest::getDefaultHeaders() as $name => $value) { |
344 | - $headers[] = $name . ': ' . $value; |
|
344 | + $headers[] = $name.': '.$value; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | return $headers; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $accessToken = new AccessToken('foo_token'); |
34 | 34 | |
35 | 35 | $this->assertEquals('foo_token', $accessToken->getValue()); |
36 | - $this->assertEquals('foo_token', (string)$accessToken); |
|
36 | + $this->assertEquals('foo_token', (string) $accessToken); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function testAnAppSecretProofWillBeProperlyGenerated() |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | |
101 | 101 | $newAccessToken = unserialize(serialize($accessToken)); |
102 | 102 | |
103 | - $this->assertEquals((string)$accessToken, (string)$newAccessToken); |
|
103 | + $this->assertEquals((string) $accessToken, (string) $newAccessToken); |
|
104 | 104 | $this->assertEquals($accessToken->getExpiresAt(), $newAccessToken->getExpiresAt()); |
105 | 105 | } |
106 | 106 | |
107 | 107 | private function aWeekFromNow() |
108 | 108 | { |
109 | - return time() + (60 * 60 * 24 * 7);//a week from now |
|
109 | + return time() + (60 * 60 * 24 * 7); //a week from now |
|
110 | 110 | } |
111 | 111 | } |
@@ -82,19 +82,19 @@ |
||
82 | 82 | |
83 | 83 | $this->assertContains('*', $authUrl); |
84 | 84 | |
85 | - $expectedUrl = 'https://www.facebook.com/' . static::TESTING_GRAPH_VERSION . '/dialog/oauth?'; |
|
85 | + $expectedUrl = 'https://www.facebook.com/'.static::TESTING_GRAPH_VERSION.'/dialog/oauth?'; |
|
86 | 86 | $this->assertTrue(strpos($authUrl, $expectedUrl) === 0, 'Unexpected base authorization URL returned from getAuthorizationUrl().'); |
87 | 87 | |
88 | 88 | $params = [ |
89 | 89 | 'client_id' => '123', |
90 | 90 | 'redirect_uri' => 'https://foo.bar', |
91 | 91 | 'state' => 'foo_state', |
92 | - 'sdk' => 'php-sdk-' . Facebook::VERSION, |
|
92 | + 'sdk' => 'php-sdk-'.Facebook::VERSION, |
|
93 | 93 | 'scope' => implode(',', $scope), |
94 | 94 | 'foo' => 'bar', |
95 | 95 | ]; |
96 | 96 | foreach ($params as $key => $value) { |
97 | - $this->assertContains($key . '=' . urlencode($value), $authUrl); |
|
97 | + $this->assertContains($key.'='.urlencode($value), $authUrl); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | 'client_id' => '123', |
65 | 65 | 'redirect_uri' => self::REDIRECT_URL, |
66 | 66 | 'state' => $this->persistentDataHandler->get('state'), |
67 | - 'sdk' => 'php-sdk-' . Facebook::VERSION, |
|
67 | + 'sdk' => 'php-sdk-'.Facebook::VERSION, |
|
68 | 68 | 'scope' => implode(',', $scope), |
69 | 69 | ]; |
70 | 70 | foreach ($params as $key => $value) { |
71 | - $this->assertContains($key . '=' . urlencode($value), $loginUrl); |
|
71 | + $this->assertContains($key.'='.urlencode($value), $loginUrl); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ]; |
85 | 85 | foreach ($params as $key => $value) { |
86 | 86 | $this->assertTrue( |
87 | - strpos($logoutUrl, $key . '=' . urlencode($value)) !== false |
|
87 | + strpos($logoutUrl, $key.'='.urlencode($value)) !== false |
|
88 | 88 | ); |
89 | 89 | } |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $accessToken = $this->redirectLoginHelper->getAccessToken(self::REDIRECT_URL); |
99 | 99 | |
100 | - $this->assertEquals('foo_token_from_code|foo_code|' . self::REDIRECT_URL, (string)$accessToken); |
|
100 | + $this->assertEquals('foo_token_from_code|foo_code|'.self::REDIRECT_URL, (string) $accessToken); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | public function testACustomCsprsgCanBeInjected() |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | if ($this->respondWith == 'FAIL_ON_START') { |
60 | 60 | return new GraphRawResponse( |
61 | 61 | "HTTP/1.1 500 OK\r\nFoo: Bar", |
62 | - '{"error":{"message":"Error validating access token: Session has expired on Monday, ' . |
|
63 | - '10-Aug-15 01:00:00 PDT. The current time is Monday, 10-Aug-15 01:14:23 PDT.",' . |
|
62 | + '{"error":{"message":"Error validating access token: Session has expired on Monday, '. |
|
63 | + '10-Aug-15 01:00:00 PDT. The current time is Monday, 10-Aug-15 01:14:23 PDT.",'. |
|
64 | 64 | '"type":"OAuthException","code":190,"error_subcode":463}}' |
65 | 65 | ); |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if ($this->respondWith == 'FAIL_ON_TRANSFER') { |
77 | 77 | return new GraphRawResponse( |
78 | 78 | "HTTP/1.1 500 OK\r\nFoo: Bar", |
79 | - '{"error":{"message":"There was a problem uploading your video. Please try uploading it again.",' . |
|
79 | + '{"error":{"message":"There was a problem uploading your video. Please try uploading it again.",'. |
|
80 | 80 | '"type":"FacebookApiException","code":6000,"error_subcode":1363019}}' |
81 | 81 | ); |
82 | 82 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | { |
44 | 44 | $params = $request->getParams(); |
45 | 45 | $rawResponse = json_encode([ |
46 | - 'access_token' => 'foo_access_token_from:' . $params['code'], |
|
46 | + 'access_token' => 'foo_access_token_from:'.$params['code'], |
|
47 | 47 | ]); |
48 | 48 | |
49 | 49 | return new FacebookResponse($request, $rawResponse, 200); |
@@ -29,6 +29,6 @@ |
||
29 | 29 | { |
30 | 30 | public function getAccessTokenFromCode($code, $redirectUri = '', $machineId = null) |
31 | 31 | { |
32 | - return 'foo_token_from_code|' . $code . '|' . $redirectUri; |
|
32 | + return 'foo_token_from_code|'.$code.'|'.$redirectUri; |
|
33 | 33 | } |
34 | 34 | } |