Permalink
Browse files

test api exception in code exchange is ignored

  • Loading branch information...
daaku committed Jul 10, 2012
1 parent da3e40a commit ad7b8b5626c9650e7a731dab9aee416c51e9ad58
Showing with 17 additions and 0 deletions.
  1. +17 −0 tests/tests.php
View
@@ -1114,6 +1114,23 @@ public function testNullRedirectURIAllowsEmptyStringForCookie() {
$access_token, $stub->publicGetAccessTokenFromCode('c', ''));
}
+ public function testAPIExceptionDuringCodeExchangeIsIgnored() {
+ $methods_to_stub = array(
+ '_oauthRequest',
+ );
+ $constructor_args = array(array(
+ 'appId' => self::APP_ID,
+ 'secret' => self::SECRET
+ ));
+ $stub = $this->getMock(
+ 'FBPublicGetAccessTokenFromCode', $methods_to_stub, $constructor_args);
+ $stub
+ ->expects($this->once())
+ ->method('_oauthRequest')
+ ->will($this->throwException(new FacebookApiException(false)));
+ $this->assertFalse($stub->publicGetAccessTokenFromCode('c', ''));
+ }
+
public function testExceptionConstructorWithErrorCode() {
$code = 404;
$e = new FacebookApiException(array('error_code' => $code));

0 comments on commit ad7b8b5

Please sign in to comment.