$photo=['permalink_url'=>'https://www.facebook.com/example.page/posts/pfbid123/?tracking=test','message'=>'Foto van Facebook','full_picture'=>'https://scontent-test.fbcdn.net/image.jpg','created_time'=>'2026-01-04T10:00:00Z'];
$text=['permalink_url'=>'https://m.facebook.com/story.php?story_fbid=888&id=12345&tracking=test','message'=>'Bericht zonder foto','created_time'=>'2026-01-02T10:00:00Z'];
hgsf_test(is_wp_error(hgsf_sync_source('x'))&&!$requests,'No X API use without opt-in, even with a token.');
hgsf_test(hgsf_sync_instagram()===true&&count($requests)===3,'Legacy Instagram configuration and token renewal.');
hgsf_test(count($snapshots['instagram']['posts'])===10&&str_ends_with($snapshots['instagram']['posts'][0]['image'],'/video.jpg'),'Instagram host checks, order and video thumbnail.');
hgsf_test(wp_script_is('hg-socialfeed-x','enqueued'),'The mixed feed loads the official X embed script.');
hgsf_test(count($requests)===$request_count,'Shortcodes must never call a provider API.');
hgsf_test(substr_count($html,'tabindex="-1"')===13&&str_contains($html,'Meer berichten'),'All three feeds and load more.');
hgsf_test(strpos($html,'pfbid123')<strpos($html,'/status/991')&&strpos($html,'/status/991')<strpos($html,'story_fbid=888'),'Combined order uses publication dates.');
hgsf_test(!str_contains($html,'tracking=')&&!str_contains($html,'igsh=')&&str_contains($html,'"bericht"'),'Strip tracking and escape captions.');
hgsf_test(str_contains($html,'Bericht zonder foto')&&str_contains($html,'data-dnt="true"'),'Facebook text and official X embed.');
hgsf_test(substr_count($icons,'<svg ')===3&&str_contains($icons,'facebook.com/example.page')&&!str_contains($icons,'/status/'),'Icon bar links to configured profile pages.');
hgsf_test(!str_contains(do_shortcode('[hg_sociallinks sources="x"]'),'instagram.com'),'Icon bar source selection.');
hgsf_test(!str_contains($html.$icons,'-fixture-token')&&!str_contains($html.$icons,'x%2Ffixture'),'No public credentials.');
hgsf_test(substr_count($admin_html,'aria-current="page"')===1,'One active admin tab for '.$tab);
hgsf_test(!str_contains($admin_html,'-fixture-token'),'Admin does not reveal tokens for '.$tab);
if($tab==='shortcodes'){
hgsf_test(!str_contains($admin_html,'type="password"')&&str_contains($admin_html,'[hg_sociallinks]'),'Shortcode tab shows usage without connection fields.');
}else{
hgsf_test(substr_count($admin_html,'type="password"')===1&&str_contains($admin_html,'name="source" value="'.$tab.'"'),'Only the selected platform form renders.');
hgsf_test(hgsf_save_settings('facebook',['operation'=>'save','username'=>'12345','profile'=>'updated.page'])==='saved','Updating the Facebook profile link succeeds.');
hgsf_test($connections['facebook']['token']==='fb-fixture-token'&&count($requests)===$request_count,'Updating an icon link preserves the Page token without fetching posts.');
hgsf_test(str_contains(do_shortcode('[hg_sociallinks sources="facebook"]'),'facebook.com/updated.page'),'Updated profile link is reflected in the icon bar.');