fix(templates): bump Tested up to 7.1, robust version compare, REST item schema (A, B, C) - #15
Merged
Merged
Conversation
…tem schema (A, B, C)
A — TESTED_UP_TO
- Extract a TESTED_UP_TO constant ('7.1', was inline '6.9' two majors
stale) next to MIN_PHP, and a versionGte() helper comparing
dot-separated integer segments instead of parseFloat() (which
mis-parses two-digit segments: parseFloat('6.10') === 6.1).
B — dangling {@see Services} in accessor-less builds
- Plugin.php's class docblock only mentions the Services locator under
{{#if has_services}} now, matching the same accessor-conditional
wiring #16 already applied to Services.php/Plugin_TestCase.php.
Reflowed the two sentences so the accessor-less docblock still reads
cleanly rather than leaving an orphaned clause.
C — REST controller shipped no schema
- Rest_Controller::get_item_schema() now describes get_items()'s
actual response shape (message: string, param: string|null), wired
into register_routes() via 'schema' => $this->get_public_item_schema( ... )
(first-class callable, matching the file's existing style).
- Extended the WP_REST_Controller unit-test stub (tests/bootstrap.php)
with $schema, get_public_item_schema(), and add_additional_fields_schema()
— real WP core provides these; the minimal stub didn't, which would
have fataled every generated test that hits register_routes() now
that it calls get_public_item_schema().
- New Rest_Controller_Test covering the schema shape.
Verified beyond the CLI's own 69/69 suite: generated a real --modules
rest_api,caching scaffold, ran composer install + composer test for
real (12/12 PHPUnit tests, 17 assertions — the __() stub gap in the
new test was only caught this way) and composer lint (15/15 files,
0 errors/0 warnings). Also confirmed the has_services docblock split
renders cleanly in both an accessor-less and an accessor-bearing
scaffold, and Tested up to renders 7.1.
Addresses open-issues report items A, B, C.
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.
Addresses items A, B, C from the open-issues report.
A —
Tested up to: 6.9is two majors behindTESTED_UP_TOconstant ('7.1') next toMIN_PHP, plus aversionGte()helper that compares dot-separated integer segments instead ofparseFloat()on a version string (parseFloat('6.10') === 6.1, which would silently produce aTested up tobelowRequires at leastonce WP ships anx.10).B —
{@see Services}dangles in accessor-less buildsPlugin.php's class docblock now only mentions the Services locator under{{#if has_services}}, reusing the same flag fix(templates): nest the REST endpoint so 'schema' survives register_rest_route()'s upgrade step (C) #16 already wired throughServices.php/Plugin_TestCase.php. Reflowed the surrounding sentences so the accessor-less docblock still reads cleanly instead of leaving an orphaned clause mid-line.C — REST controller shipped no schema
Rest_Controller::get_item_schema()now describesget_items()'s actual response shape (message: string,param: string|null), wired intoregister_routes()via'schema' => $this->get_public_item_schema( ... )(first-class callable, matching the file's existing style).WP_REST_Controllerunit-test stub (tests/bootstrap.php) with$schema,get_public_item_schema(), andadd_additional_fields_schema()— real WP core provides these; the stub didn't, which would have fataled every generated test hittingregister_routes()now that it callsget_public_item_schema().Rest_Controller_Test::test_get_item_schema_describes_the_response_shape.Verification
Beyond the CLI's own suite (
npm test: 69/69):--modules rest_api,cachingscaffold and ran it for real:composer install+composer test→ 12/12 PHPUnit tests, 17 assertions (the__()stub gap in the new test was only caught this way — first attempt fatal'd with "Call to undefined function__()", fixed by stubbing it via Brain Monkey like the rest of the suite does).composer lint→ 15/15 files scanned, 0 errors / 0 warnings, exit 0.has_services-gatedPlugin.phpdocblock renders cleanly in both an accessor-less scaffold (--modules "") and an accessor-bearing one.readme.txtrendersTested up to: 7.1.php -lclean on every generated file in both scaffolds.D (test suite depth) is out of scope here — it's flagged as the larger, separate item in the report.
🤖 Generated with Claude Code