Skip to content

Use plugin-prefixed admin hooks and tighten test stubs#83

Merged
happyloa merged 1 commit intomainfrom
codex/fix-mismatched-text-domain-in-plugin
Dec 21, 2025
Merged

Use plugin-prefixed admin hooks and tighten test stubs#83
happyloa merged 1 commit intomainfrom
codex/fix-mismatched-text-domain-in-plugin

Conversation

@happyloa
Copy link
Owner

Motivation

  • Ensure admin-side filter hooks use a clear, plugin-specific prefix to avoid naming collisions and improve discoverability.
  • Make test stubs safer and more realistic by applying proper escaping to template output.
  • Avoid creating an unprefixed global WP_CLI class in tests which could conflict with the real environment.

Description

  • Rename admin filter hooks to use the plugin prefix by changing siteadwa_main_admin_history_display to site_add_on_watchdog_admin_history_display in src/AdminPage.php.
  • Rename the admin per-page filter in the admin template from siteadwa_main_admin_risks_per_page to site_add_on_watchdog_admin_risks_per_page in templates/admin-page.php.
  • Improve the history template test stub to echo escaped output by changing the esc_html_e test alias to echo esc_html($text) in tests/RiskHistoryTest.php.
  • Replace the unprefixed WP_CLI test stub with a prefixed Watchdog_WP_CLI class and add a class_alias to WP_CLI in tests/Cli/ScanCommandTest.php to avoid global name collisions.

Testing

  • No automated test suite was executed as part of this change.
  • Files modified: src/AdminPage.php, templates/admin-page.php, tests/Cli/ScanCommandTest.php, and tests/RiskHistoryTest.php.
  • Local commit was created successfully containing these changes.
  • Further CI or unit test runs are recommended to validate behavior in full environments.

Codex Task

@happyloa happyloa merged commit 86bf48f into main Dec 21, 2025
2 checks passed
@happyloa happyloa deleted the codex/fix-mismatched-text-domain-in-plugin branch December 21, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant