Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Translate testLoginStatusURL_Defaults

  • Loading branch information...
commit c8dc8908fd03e11a6b2b0f1f53b7e0b2d988f382 1 parent 74cfc23
@guywithnose authored
View
9 src/facebook/BaseFacebook.java
@@ -499,12 +499,9 @@ public String getLogoutUrl()
*/
public String getLogoutUrl(HashMap<String, String> params)
{
- /*
- * TODO Translate return getUrl( 'www', 'logout.php', array_merge(array(
- * 'next' => getCurrentUrl(), 'access_token' => getAccessToken(), ),
- * $params) );
- */
- return null;
+ params.put("next",getCurrentUrl());
+ params.put("access_token",getAccessToken());
+ return getUrl( "www", "logout.php", params );
}
/**
View
47 testsrc/facebook/tests/facebookTest.java
@@ -772,29 +772,32 @@ public void testLogoutURL_Defaults()
{
e.printStackTrace();
}
- assertNotNull("Expect the current url to exist.", facebook.getLogoutUrl()
- .indexOf(encodedUrl));
+ assertFalse("Expect the current url to exist.", facebook.getLogoutUrl()
+ .indexOf(encodedUrl) == -1);
}
-
- /**
- * Tests the loginStatusURL method using defaults.
- */
- @Test
- public void testLoginStatusURL_Defaults() {
- fail("Not implemented.");
- /* TODO Translate
- $_SERVER["HTTP_HOST"] = "fbrell.com";
- $_SERVER["REQUEST_URI"] = "/examples";
- $facebook = new TransientFacebook(array(
- "appId" => self::APP_ID,
- "secret" => self::SECRET,
- ));
- $encodedUrl = rawurlencode("http://fbrell.com/examples");
- assertNotNull(strpos($facebook->getLoginStatusUrl(), $encodedUrl),
- "Expect the current url to exist.");
- */
- }
-
+
+ /**
+ * Tests the loginStatusURL method using defaults.
+ */
+ @Test
+ public void testLoginStatusURL_Defaults()
+ {
+ HttpServletRequestMock req = new HttpServletRequestMock();
+ TransientFacebook facebook = new TransientFacebook(config, req);
+ req.setRequestString("http://fbrell.com/examples");
+ String encodedUrl = "";
+ try
+ {
+ encodedUrl = URLEncoder
+ .encode("http://fbrell.com/examples", "ISO-8859-1");
+ } catch (UnsupportedEncodingException e)
+ {
+ e.printStackTrace();
+ }
+ assertFalse("Expect the current url to exist.", facebook
+ .getLoginStatusUrl().indexOf(encodedUrl) == -1);
+ }
+
/**
* Tests the loginStatusURL method using custom.
*/
Please sign in to comment.
Something went wrong with that request. Please try again.