Repository navigation
Conversation
ScheduleDiscovery derives default hook names itself, matching Str::snake() so scheduled hooks keep their name. Adds the first tests that run the discovery, a parity test and an architecture test; the bridge to Laravel's scheduler stays in the framework.
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.
First step of extracting
pollora/schedule(roadmap, medium term: "keep only WP-Cron in the package"). Nothing moves yet.What changes
ScheduleDiscovery, the part of the module that runs on WP-Cron alone, no longer usesIlluminate\Support\Strandclass_basename(): it derives default hook names itself (NightlyReports::compile()→nightly_reports_compile). A parity test pins the result toStr::snake()on several shapes of names, so hooks already scheduled under a derived name keep it.tests/Unit/Schedule/ScheduleDiscoveryTest.php: the first tests that run the discovery: each method scheduled on its hook (named or derived) with its recurrence and arguments, the schedules WordPress does not know (Every::MONTH,Interval) added throughcron_schedules, the method run with its arguments when the hook fires.tests/Unit/Schedule/PackageBoundaryTest.php:ScheduleDiscoverymay only use the attributes, discovery, PSR logging and WP-Cron. It fails on the previous code (also uses 'Illuminate\Support\Str').The bridge to Laravel's scheduler (
wordpress.use_laravel_scheduler:Scheduler, its events and jobs, thewp_eventstable) is Laravel by nature and stays in the framework.Checks
1888 tests, PHPStan 0, Pint and Rector clean. Independent of #464 and #465.