Skip to content

Commit 21321ff

Browse files
committed
test missing access token in code exchange is ignored
1 parent d8a5366 commit 21321ff

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/tests.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,23 @@ public function testEmptyResponseInCodeExchangeIsIgnored() {
11481148
$this->assertFalse($stub->publicGetAccessTokenFromCode('c', ''));
11491149
}
11501150

1151+
public function testMissingAccessTokenInCodeExchangeIsIgnored() {
1152+
$methods_to_stub = array(
1153+
'_oauthRequest',
1154+
);
1155+
$constructor_args = array(array(
1156+
'appId' => self::APP_ID,
1157+
'secret' => self::SECRET
1158+
));
1159+
$stub = $this->getMock(
1160+
'FBPublicGetAccessTokenFromCode', $methods_to_stub, $constructor_args);
1161+
$stub
1162+
->expects($this->once())
1163+
->method('_oauthRequest')
1164+
->will($this->returnValue('foo=1'));
1165+
$this->assertFalse($stub->publicGetAccessTokenFromCode('c', ''));
1166+
}
1167+
11511168
public function testExceptionConstructorWithErrorCode() {
11521169
$code = 404;
11531170
$e = new FacebookApiException(array('error_code' => $code));

0 commit comments

Comments
 (0)