feat(report-module): implement Report_Module — widget, reports page, freeze cron#106
Merged
Conversation
2be7ce4 to
4cf8474
Compare
ec318be to
e52d884
Compare
…freeze cron (#96) Moves Dashboard_Widget and Reports_Page registration and the sybgo_freeze_weekly_report cron callback from Sybgo into Report_Module::boot() and the new named freeze_report_callback() method. Removes create_dashboard_widget(), create_reports_page(), and freeze_weekly_report_callback() from class-sybgo.php. Adds ReportModuleTest covering admin page registration, cron wiring, and callback logic for both frozen and no-active-report paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…module boot Report_Module::boot() registers the freeze cron and admin pages via the shared Cron_Manager and Admin_Manager instances, but their init() was never called — init_cron_schedules() removed sybgo_freeze_weekly_report and init_admin() used a separate Admin_Manager instance. Add the two init() calls so the module's registrations actually take effect before the legacy sub-methods run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e7d8166 to
6c3b4e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Moves Dashboard_Widget and Reports_Page registration and the `sybgo_freeze_weekly_report` cron callback from `Sybgo` into `Report_Module::boot()` and a new public named method `freeze_report_callback()`, making the freeze logic independently testable.
Closes #96
Type of change
Detailed scenario
What was tested
wp cron event run sybgo_freeze_weekly_report— report froze successfully; confirmed in DB withwp db query "SELECT status FROM wp_sybgo_reports ORDER BY id DESC LIMIT 1"(showedfrozen).How to test
feat/report-module-96and runcomposer dump-autoloadinwp-plugin/.cd tests/e2e && npx wp-env start.cd wp-plugin && vendor/bin/phpunit --testsuite=Unit— 5 new ReportModuleTest tests pass.wp cron event run sybgo_freeze_weekly_report— confirm the report is frozen in the DB.Affected Features & Quality Assurance Scope
Dashboard widget, reports page, and the weekly freeze cron are the affected features — behaviour is identical, only wiring location changed. All other plugin features unchanged.
Technical description
Report_Module::boot()callsAdmin_Manager::register_page()for bothDashboard_WidgetandReports_Page(built via private factory helpers that mirror the removedcreate_*methods fromSybgo). It callsCron_Manager::register('sybgo_freeze_weekly_report', 'weekly', [$this, 'freeze_report_callback'], 'next Sunday 23:55').freeze_report_callback()is public and named, which allowsCronManagerto store[$module, 'freeze_report_callback']as a callable — this is what makes it unit-testable in isolation fromboot().Removed from
class-sybgo.php:create_dashboard_widget(),create_reports_page(),freeze_weekly_report_callback(), and the dashboard widget / reports page lines insideinit_admin(). The freeze scheduling and callback registration insideinit_cron_schedules()are also removed.New dependencies
None.
Risks
None identified. Dashboard widget, reports page, and freeze cron behaviour are unchanged; only the class that wires them differs.
Mandatory Checklist
Code validation
Code style
Unticked items justification
None.
Additional Checks