Skip to content

Commit b1c72d1

Browse files
committed
Added test cases
1 parent 9d48501 commit b1c72d1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/tests.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,31 @@ public function testMissingAccessTokenInCodeExchangeIsIgnored() {
13051305
$this->assertFalse($stub->publicGetAccessTokenFromCode('c', ''));
13061306
}
13071307

1308+
public function testAppsecretProofNoParams() {
1309+
$fb = new FBRecordMakeRequest(array(
1310+
'appId' => self::APP_ID,
1311+
'secret' => self::SECRET,
1312+
));
1313+
$token = $fb->getAccessToken();
1314+
$proof = $fb->publicGetAppSecretProof($token);
1315+
$params = array();
1316+
$fb->api('/mattynoce', $params);
1317+
$requests = $fb->publicGetRequests();
1318+
$this->assertEquals($proof, $requests[0]['params']['appsecret_proof']);
1319+
}
1320+
1321+
public function testAppsecretProofWithParams() {
1322+
$fb = new FBRecordMakeRequest(array(
1323+
'appId' => self::APP_ID,
1324+
'secret' => self::SECRET,
1325+
));
1326+
$proof = 'foo';
1327+
$params = array('appsecret_proof' => $proof);
1328+
$fb->api('/mattynoce', $params);
1329+
$requests = $fb->publicGetRequests();
1330+
$this->assertEquals($proof, $requests[0]['params']['appsecret_proof']);
1331+
}
1332+
13081333
public function testExceptionConstructorWithErrorCode() {
13091334
$code = 404;
13101335
$e = new FacebookApiException(array('error_code' => $code));
@@ -1891,6 +1916,10 @@ protected function makeRequest($url, $params, $ch=null) {
18911916
public function publicGetRequests() {
18921917
return $this->requests;
18931918
}
1919+
1920+
public function publicGetAppSecretProof($access_token) {
1921+
return $this->getAppSecretProof($access_token);
1922+
}
18941923
}
18951924

18961925
class FBPublic extends TransientFacebook {

0 commit comments

Comments
 (0)