Skip to content

Commit b8dc052

Browse files
committed
Minor formatting and refactorings
1 parent 5a88ed7 commit b8dc052

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/base_facebook.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,10 @@ protected function getUrl($name, $path='', $params=array()) {
10011001
* @return string The current URL
10021002
*/
10031003
protected function getCurrentUrl() {
1004-
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1)
1005-
|| isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
1006-
) {
1004+
if (isset($_SERVER['HTTPS']) &&
1005+
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
1006+
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
1007+
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
10071008
$protocol = 'https://';
10081009
}
10091010
else {

tests/tests.php

+11-10
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public function testGraphAPIMethod() {
427427
} catch(FacebookApiException $e) {
428428
// ProfileDelete means the server understood the DELETE
429429
$msg =
430-
'OAuthException: A user access token is required to request this resource.';
430+
'OAuthException: (#200) User cannot access this application';
431431
$this->assertEquals($msg, (string) $e,
432432
'Expect the invalid session message.');
433433
}
@@ -685,19 +685,20 @@ public function testAppSecretCall() {
685685
'secret' => self::SECRET,
686686
));
687687

688-
$proper_exception_thrown = false;
689688
try {
690689
$response = $facebook->api('/' . self::APP_ID . '/insights');
691690
$this->fail('Desktop applications need a user token for insights.');
692691
} catch (FacebookApiException $e) {
693-
$proper_exception_thrown =
694-
strpos($e->getMessage(),
695-
'Requires session when calling from a desktop app') !== false;
696-
} catch (Exception $e) {}
697-
698-
$this->assertTrue($proper_exception_thrown,
699-
'Incorrect exception type thrown when trying to gain '.
700-
'insights for desktop app without a user access token.');
692+
// this test is failing as the graph call is returning the wrong
693+
// error message
694+
$this->assertTrue(strpos($e->getMessage(),
695+
'Requires session when calling from a desktop app') !== false,
696+
'Incorrect exception type thrown when trying to gain ' .
697+
'insights for desktop app without a user access token.');
698+
} catch (Exception $e) {
699+
$this->fail('Incorrect exception type thrown when trying to gain ' .
700+
'insights for desktop app without a user access token.');
701+
}
701702
}
702703

703704
public function testBase64UrlEncode() {

0 commit comments

Comments
 (0)