Skip to content

fix(templates): bump Tested up to 7.1, robust version compare, REST item schema (A, B, C) - #15

Merged
akshat009 merged 1 commit into
mainfrom
fix/tested-up-to-and-rest-schema
Aug 30, 2026
Merged

fix(templates): bump Tested up to 7.1, robust version compare, REST item schema (A, B, C)#15
akshat009 merged 1 commit into
mainfrom
fix/tested-up-to-and-rest-schema

Conversation

@akshat009

Copy link
Copy Markdown
Owner

Addresses items A, B, C from the open-issues report.

A — Tested up to: 6.9 is two majors behind

  • Extracted a TESTED_UP_TO constant ('7.1') next to MIN_PHP, plus a versionGte() helper that compares dot-separated integer segments instead of parseFloat() on a version string (parseFloat('6.10') === 6.1, which would silently produce a Tested up to below Requires at least once WP ships an x.10).

B — {@see Services} dangles in accessor-less builds

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 stub didn't, which would have fataled every generated test hitting register_routes() now that it calls get_public_item_schema().
  • Added Rest_Controller_Test::test_get_item_schema_describes_the_response_shape.

Verification

Beyond the CLI's own suite (npm test: 69/69):

  • Generated a real --modules rest_api,caching scaffold and ran it for real:
    • composer install + composer test12/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 lint15/15 files scanned, 0 errors / 0 warnings, exit 0.
  • Confirmed the has_services-gated Plugin.php docblock renders cleanly in both an accessor-less scaffold (--modules "") and an accessor-bearing one.
  • Confirmed readme.txt renders Tested up to: 7.1.
  • php -l clean 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

…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.
@akshat009
akshat009 merged commit 5a2a7d7 into main Aug 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant