Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds initial PHPUnit coverage for the REST layer in OneSearch, focusing on controller route registration, permission-sensitive behavior, and governing/consumer data flows. This fits the codebase by expanding unit coverage around the plugin’s cross-site REST integration points.
Changes:
- Adds new unit test files for the abstract REST controller and the main REST controllers/handler.
- Covers route registration, option reads/writes, brand config retrieval, indexable entities, and reindex behavior.
- Adds permission and origin/header checks for same-origin and cross-origin REST requests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
tests/php/Unit/Modules/Rest/Abstract_REST_ControllerTest.php |
Adds tests for hook registration, API permission checks, and host/origin matching. |
tests/php/Unit/Modules/Rest/Basic_Options_ControllerTest.php |
Adds tests for basic settings REST endpoints such as site type, shared sites, health check, and governing site. |
tests/php/Unit/Modules/Rest/Governing_Data_ControllerTest.php |
Adds tests for brand-config and all-post-types controller behavior across site types. |
tests/php/Unit/Modules/Rest/Governing_Data_HandlerTest.php |
Adds tests for governing-data fetch/caching, child-site post type retrieval, and cache clearing. |
tests/php/Unit/Modules/Rest/Search_ControllerTest.php |
Adds tests for search controller routes, Algolia credentials, indexable entities, and reindex behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
Added REST PHPUnit test cases.
Why
Improves development workflow by enabling faster and more reliable validation of REST functionality, reducing repetitive manual testing efforts.
Related Issue(s):
How
AI Disclosure
Hybrid approach = Written by Me + Copilot (Claude Opus 4.6, GPT 5.3) + Audited by me
Testing Instructions
Screenshots
Additional Info
Checklist