Open
Conversation
Contributor
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.
Comment on lines
+134
to
+153
| * The delete still attempts (and fails without creds), but the reindex does not happen. | ||
| */ | ||
| public function test_on_post_transition_does_not_reindex_disallowed_status(): void { | ||
| update_option( Settings::OPTION_SITE_TYPE, Settings::SITE_TYPE_GOVERNING ); | ||
| update_option( | ||
| Search_Settings::OPTION_GOVERNING_INDEXABLE_SITES, | ||
| [ | ||
| 'entities' => [ | ||
| Utils::normalize_url( get_site_url() ) => [ 'post' ], | ||
| ], | ||
| ] | ||
| ); | ||
|
|
||
| $post = self::factory()->post->create_and_get( [ 'post_status' => 'publish' ] ); | ||
| $watcher = new Watcher(); | ||
|
|
||
| // Transitioning to 'trash' — should not reindex (only delete). | ||
| $watcher->on_post_transition( 'trash', 'publish', $post ); | ||
|
|
||
| $this->assertTrue( true ); |
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
Why
Related Issue(s):
How
AI Disclosure
Testing Instructions
Screenshots
Additional Info
Checklist