Permalink
Browse files

test empty string for redirect uri is allowed for fbsr cookie case

  • Loading branch information...
1 parent b913b27 commit da3e40ae7dcb3183eac29ba627d519e6e8c555dc @daaku daaku committed Jul 10, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 tests/tests.php
View
23 tests/tests.php
@@ -1091,6 +1091,29 @@ public function testNullRedirectURIUsesCurrentURL() {
$access_token, $stub->publicGetAccessTokenFromCode('c'));
}
+ public function testNullRedirectURIAllowsEmptyStringForCookie() {
+ $methods_to_stub = array(
+ '_oauthRequest',
+ 'getCurrentUrl',
+ );
+ $constructor_args = array(array(
+ 'appId' => self::APP_ID,
+ 'secret' => self::SECRET
+ ));
+ $access_token = 'at1';
+ $stub = $this->getMock(
+ 'FBPublicGetAccessTokenFromCode', $methods_to_stub, $constructor_args);
+ $stub
+ ->expects($this->once())
+ ->method('_oauthRequest')
+ ->will($this->returnValue("access_token=$access_token"));
+ $stub
+ ->expects($this->never())
+ ->method('getCurrentUrl');
+ $this->assertEquals(
+ $access_token, $stub->publicGetAccessTokenFromCode('c', ''));
+ }
+
public function testExceptionConstructorWithErrorCode() {
$code = 404;
$e = new FacebookApiException(array('error_code' => $code));

0 comments on commit da3e40a

Please sign in to comment.