Completed
Pull Request — master (#594)
by Andreas
03:19
created
tests/Helpers/FacebookRedirectLoginHelperTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 {
44 44
     public function getAccessTokenFromCode($code, $redirectUri = '', $machineId = null)
45 45
     {
46
-        return 'foo_token_from_code|' . $code . '|' . $redirectUri;
46
+        return 'foo_token_from_code|'.$code.'|'.$redirectUri;
47 47
     }
48 48
 }
49 49
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
             'client_id' => '123',
83 83
             'redirect_uri' => self::REDIRECT_URL,
84 84
             'state' => $this->persistentDataHandler->get('state'),
85
-            'sdk' => 'php-sdk-' . Facebook::VERSION,
85
+            'sdk' => 'php-sdk-'.Facebook::VERSION,
86 86
             'scope' => implode(',', $scope),
87 87
         ];
88 88
         foreach ($params as $key => $value) {
89
-            $this->assertContains($key . '=' . urlencode($value), $loginUrl);
89
+            $this->assertContains($key.'='.urlencode($value), $loginUrl);
90 90
         }
91 91
     }
92 92
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         ];
103 103
         foreach ($params as $key => $value) {
104 104
             $this->assertTrue(
105
-                strpos($logoutUrl, $key . '=' . urlencode($value)) !== false
105
+                strpos($logoutUrl, $key.'='.urlencode($value)) !== false
106 106
             );
107 107
         }
108 108
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         $accessToken = $this->redirectLoginHelper->getAccessToken(self::REDIRECT_URL);
117 117
 
118
-        $this->assertEquals('foo_token_from_code|foo_code|' . self::REDIRECT_URL, (string)$accessToken);
118
+        $this->assertEquals('foo_token_from_code|foo_code|'.self::REDIRECT_URL, (string) $accessToken);
119 119
     }
120 120
 
121 121
     public function testACustomCsprsgCanBeInjected()
Please login to merge, or discard this patch.
tests/Helpers/FacebookSignedRequestFromInputHelperTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
tests/FacebookClientTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
         $fbRequests = [
176 176
             new FacebookRequest($this->fbApp, 'token', 'POST', '/photo', [
177 177
                 'message' => 'foobar',
178
-                'source' => new FacebookFile(__DIR__ . '/foo.txt'),
178
+                'source' => new FacebookFile(__DIR__.'/foo.txt'),
179 179
             ]),
180 180
             new FacebookRequest($this->fbApp, 'token', 'POST', '/video', [
181 181
                 'message' => 'foobar',
182
-                'source' => new FacebookVideo(__DIR__ . '/foo.txt'),
182
+                'source' => new FacebookVideo(__DIR__.'/foo.txt'),
183 183
             ]),
184 184
         ];
185 185
         $fbBatchRequest = new FacebookBatchRequest($this->fbApp, $fbRequests);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
         list($url, $method, $headers, $body) = $this->fbClient->prepareRequestMessage($fbBatchRequest);
189 189
 
190
-        $this->assertEquals(FacebookClient::BASE_GRAPH_VIDEO_URL . '/' . Facebook::DEFAULT_GRAPH_VERSION, $url);
190
+        $this->assertEquals(FacebookClient::BASE_GRAPH_VIDEO_URL.'/'.Facebook::DEFAULT_GRAPH_VERSION, $url);
191 191
         $this->assertEquals('POST', $method);
192 192
         $this->assertContains('multipart/form-data; boundary=', $headers['Content-Type']);
193 193
         $this->assertContains('Content-Disposition: form-data; name="batch"', $body);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
     public function testARequestWithFilesWillBeMultipart()
211 211
     {
212
-        $myFile = new FacebookFile(__DIR__ . '/foo.txt');
212
+        $myFile = new FacebookFile(__DIR__.'/foo.txt');
213 213
         $fbRequest = new FacebookRequest($this->fbApp, 'token', 'POST', '/foo', ['file' => $myFile]);
214 214
         $response = $this->fbClient->sendRequest($fbRequest);
215 215
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $this->initializeTestApp();
235 235
 
236 236
         // Create a test user
237
-        $testUserPath = '/' . FacebookTestCredentials::$appId . '/accounts/test-users';
237
+        $testUserPath = '/'.FacebookTestCredentials::$appId.'/accounts/test-users';
238 238
         $params = [
239 239
             'installed' => true,
240 240
             'name' => 'Foo Phpunit User',
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             static::$testFacebookApp,
273 273
             static::$testFacebookApp->getAccessToken(),
274 274
             'DELETE',
275
-            '/' . $testUserId
275
+            '/'.$testUserId
276 276
         );
277 277
         $graphNode = static::$testFacebookClient->sendRequest($request)->getGraphNode();
278 278
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
     public function initializeTestApp()
283 283
     {
284
-        if (!file_exists(__DIR__ . '/FacebookTestCredentials.php')) {
284
+        if (!file_exists(__DIR__.'/FacebookTestCredentials.php')) {
285 285
             throw new FacebookSDKException(
286 286
                 'You must create a FacebookTestCredentials.php file from FacebookTestCredentials.php.dist'
287 287
             );
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@
 block discarded – undo
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
 });
Please login to merge, or discard this patch.
tests/FacebookBatchRequestTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
tests/Authentication/AccessTokenTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
tests/Authentication/OAuth2ClientTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,19 +82,19 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.