updater options
This commit is contained in:
1 parent
dccb8ed9bd
commit
db897ac2dd
8 files changed
+503
-36
No files matched your search
+19
-4
@@ -165,10 +165,25 @@ $admins = get_users(['role' => 'administrator', 'number' => 1, 'fields' => 'ID']
|
||||
hgsf_test(!empty($admins), 'An administrator is required for the nonce test.');
|
||||
wp_set_current_user($admins[0]);
|
||||
require_once ABSPATH . 'wp-admin/includes/template.php';
|
||||
ob_start();
|
||||
hgsf_admin_page();
|
||||
$admin_html = ob_get_clean();
|
||||
hgsf_test(substr_count($admin_html, 'type="password"') === 3 && !str_contains($admin_html, '-fixture-token'), 'Admin renders three source settings without revealing tokens.');
|
||||
$original_tab = $_GET['tab'] ?? null;
|
||||
foreach (['instagram', 'facebook', 'x', 'shortcodes'] as $tab) {
|
||||
$_GET['tab'] = $tab;
|
||||
ob_start();
|
||||
hgsf_admin_page();
|
||||
$admin_html = ob_get_clean();
|
||||
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.');
|
||||
}
|
||||
}
|
||||
if ($original_tab === null) {
|
||||
unset($_GET['tab']);
|
||||
} else {
|
||||
$_GET['tab'] = $original_tab;
|
||||
}
|
||||
$request_count = count($requests);
|
||||
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.');
|
||||
|
||||
Reference in new issue
Block a user