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 want to add share this on Facebook to a page. I've got this
Iam coding a dating application for facebook. The application has to have a standalone
I have a canvas Facebook application, I have all user friends in JS array,
I have a Facebook iframe application that I am monetizing via Google Adsense. On
My Facebook application contains Javascript that works in Firefox and IE, but aborts in
I am building a Facebook App which is heavy on Javascript. For this I
Using the Facebook API, is there a way of getting a friend's phone/cell number?
I have looked on FaceBook Developer page and found that it's possible to create
I'm trying to access the Facebook API Admin.getMetrics method via jQuery. I'm correctly composing
I am writing an iframe based facebook app. Now I want to use the

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.