test: Search PHPUnit tests#213
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds PHPUnit unit tests for the Search module’s WordPress integration points and for the Algolia Index wrapper, helping validate hook registration and several “remote post” mapping behaviors.
Changes:
- Add
SearchTestcovering hook registration and selected behaviors for permalinks, author fields, term links, and rendered block rewriting. - Add
IndexTestcovering error returns when prerequisites are missing and verifyingIndex::get_index()caching behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tests/php/Unit/Modules/Search/SearchTest.php | Introduces unit tests for OneSearch\Modules\Search\Search behaviors (hooks, mapping, block output). |
| tests/php/Unit/Modules/Search/IndexTest.php | Introduces unit tests for OneSearch\Modules\Search\Index error handling and caching. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sabbir1991
left a comment
There was a problem hiding this comment.
Please review the coverage HTML again and check the functions are fully covered which test you have written
… Index and Search modules
…s during delete, save, and search operations
…t, and WatcherTest
justlevine
left a comment
There was a problem hiding this comment.
Great first pass! 🙌 Especially a fan of daab8dc before I even asked ;-)
Just some minor cleanup and trying to cover the few areas the coverage report missed. We'll be refactoring soon though, so if something I asked for isn't easily testable, lmk and maybe we'll skip it.
…ling and remove unused code
…ges in SettingsTest and WatcherTest
… resets and updating settings test logic
What
Added Search Module 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