Repository navigation
test: raise the coverage to 97.5 % - #16
Merged
Merged
Conversation
added 2 commits
November 13, 2026 20:13
… the index and the discovery
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.
Raises the coverage of the package from 84.7 % to 97.5 % (measured locally with PHP 8.4 and pcov; equal to the recorded ratchet), with tests only (
src/is untouched).40 tests (107 to 147) in five new files and a fixture: the cron-event and migrate commands, the registrar, the edges of the engine (the cron options interceptor,
CronIndex), and the schedule surface (fluent shortcuts,ScheduleFake,ScheduleDiscovery).tests/Support/WpCliFake.phpsimulates WP-CLI (WP_CLI,Cron_Event_Command,Formatter,WP_Error), each guarded byclass_exists. Time is fixed:ScheduleEnginehas an injectable clock (useClock) and the tests use fixed timestamps; onlyActionSchedulerDriverreadstime().One existing test is touched:
PackageBoundaryTestgets six lines. Once the WP-CLI fakes are loaded, the architecture test seesWP_CLI,WP_CLI\Formatter,Cron_Event_Command,is_wp_errorandwp_list_pluckused insrc/, which it ignored before only because they did not resolve; they are added to itsignoringlist with the other WordPress names. Nothing else in that test is relaxed.Not covered, and why: the
ActionScheduler-absent paths ofActionSchedulerDriver(lines 50, 58; the fake class stays defined for the process),Schedule.php162-164 (driver choice whenadd_filterdoes not exist: Brain Monkey defines it for the process), theAssertionErrorfallback ofScheduleFakewithout PHPUnit, theCron_Event_Command-absent branch ofRegistrar(Pest 3 has norunInSeparateProcess()), and a few isolated lines. Seen in the code and left as it is:ScheduleDiscovery.php:135builds the class name for a class without namespace as\Name, so a log message starts with a backslash (cosmetic).The ratchet in
.harness.jsongoes from 84.7 to 97. The 147 tests pass in random orders and in a Linux container (php:8.4-cli); Pint, PHPStan, Rector (--dry-run) andtests/Arch.phpare clean.