Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 836641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:01:01+00:00 2026-05-15T05:01:01+00:00

In my Facebook application, I have one Facebook wrapper class to encapsulates some call

  • 0

In my Facebook application, I have one Facebook wrapper class to encapsulates some call to Facebook API. I want to to write a unit test for this wrapper class, but since it depends on a so called “access token”, which we should get from Facebook dynamically, I’m not sure if it’s possible to write one.

But apparently the Facebook SDK itself has a PHPUnit test class. After studying the test code for a while, I know that involves a creation of dummy cookie-based session key.

private static $VALID_EXPIRED_SESSION = array(
    'access_token' => '254752073152|2.I_eTFkcTKSzX5no3jI4r1Q__.3600.1273359600-1677846385|uI7GwrmBUed8seZZ05JbdzGFUpk.',
    'expires' => '1273359600',
    'secret' => '0d9F7pxWjM_QakY_51VZqw__',
    'session_key' => '2.I_eTFkcTKSzX5no3jI4r1Q__.3600.1273359600-1677846385',
    'sig' => '9f6ae89510b30dddb3f864f3caf32fb3',
    'uid' => '1677846385'
);

.
.
.

$cookieName = 'fbs_' . self::APP_ID;
$session = self::$VALID_EXPIRED_SESSION;
$_COOKIE[$cookieName] = '"' . http_build_query($session) . '"';

What I don’t understand is, how do I get the “access_token”, “sig”, “session_key” etc? As far as I’m concerned, it should be dynamically exchanged from Facebook and involves user action (logging in).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:01:02+00:00Added an answer on May 15, 2026 at 5:01 am

    I’m not familiar with facebook development at all. However, there is a general pattern called “dependency injection” you might want to look in to.

    If you have some object in the class you are testing that needs to be faked, you write your code so that you can pass in the object that needs to be faked. http://en.wikipedia.org/wiki/Dependency_injection

    Does this help at all?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating one facebook application with FBML. What I want is: I have several
I have developed a Facebook application using Flash as3. In this application when ever
I have been working on a facebook application which will be using Graph API
I have a simple Desktop Facebook application that allows the user to retrieve some
I have seen one application in which there was a button of write a
I have been developing a Facebook application and I want to fetch the private
I'm started off developing a facebook application. One of the requirements is to have
Currently I have one monitor application in production. The job of this monitor is
I have used facebook application for one of my android application. But i need
I have implemented facebook connect application in one of my website. Everything works fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.