In my Facebook app, I have one Facebook shell class that encapsulates some call to the Facebook API. I want to write a unit test for this wrapper class, but since it depends on the so-called “access token” that we need to get dynamically from Facebook, I'm not sure if it's possible to write it.
But apparently the Facebook SDK itself has a PHPUnit test class. Having studied the test code for a while, I know that this is due to the creation of a session key based on cookies.
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) . '"';
I don’t understand how can I get "access_token", "sig", "session_key", etc.? As far as I know, it should dynamically exchange with Facebook and includes user actions (login).