Esempio n. 1
0
function fb_verify_asset($verifications_json)
{
    return fb_verify_asset_with_token($verifications_json, FB_APP_TOKEN);
}
$user3_json = load_json('user3');
$pid = get_pid($verified_json);
$uid = get_uid($verified_json);
// $accesstoken = fetch_access_token(TOKEN_FILE);
$post = get_post($uid, $pid);
$ct = json_decode($post, TRUE)['created_time'];
$er = json_decode($post, TRUE)['error']['message'];
// $user_post = get_post('100010281887017','486051034905643');
// TESTS
// $var_test = ()? PASS:FAIL;
$verified_test = fb_verify_asset($verified_json) == 1 ? PASS : FAIL;
$unverified_test = fb_verify_asset($unverified_json) != 1 ? PASS : FAIL;
$fake_networks_test = fb_verify_asset($fake_networks_json) != 1 ? PASS : FAIL;
$another_user_test = fb_verify_asset($user2_json) == 1 ? PASS : FAIL;
$third_user_test = fb_verify_asset($user3_json) == 1 ? PASS : FAIL;
$another_token_test = fb_verify_asset_with_token($verified_json, FB_APP_TOKEN_2) == 1 ? PASS : FAIL;
$pid_test = $pid == 486035954907151.0 ? PASS : FAIL;
$uid_test = $uid == 1232952150 ? PASS : FAIL;
$expected_text = preg_match("/LJEC6Q2h9JKNvZqEC87TbEXvxm4br1uivb2QX/", get_expected_text($verified_json)) ? PASS : FAIL;
// 2015-10-06T08:28:06+0000
$getpost_test = strlen($ct) == 24 ? PASS : FAIL;
$content_test = preg_match("/LJEC6Q2h9JKNvZqEC87TbEXvxm4br1uivb2QX/", parse_post($post)) ? PASS : FAIL;
$error_test = preg_match("/Error validating access token/", $er) ? FAIL : PASS;
// OUTPUT
echo "<br/>verified_test: [" . $verified_test . "]";
echo "<br/>unverified_test: [" . $unverified_test . "]";
echo "<br/>fake_networks_test: [" . $fake_networks_test . "]";
echo "<br/>another_user_test: [" . $another_user_test . "]";
echo "<br/>third_user_test: [" . $third_user_test . "]";
echo "<br/>another_token_test: [" . $another_token_test . "]";
echo "<hr/>";