Skip to content

test: Search PHPUnit tests#213

Open
Kallyan01 wants to merge 10 commits intomainfrom
test/search-phpunit-tests
Open

test: Search PHPUnit tests#213
Kallyan01 wants to merge 10 commits intomainfrom
test/search-phpunit-tests

Conversation

@Kallyan01
Copy link
Copy Markdown
Collaborator

@Kallyan01 Kallyan01 commented May 8, 2026

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

npm run wp-env:test -- start --xdebug=coverage    

npm run test:php -- tests/php/Unit/Modules/Search

Screenshots

Additional Info

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • I have added necessary tests to cover my changes.
  • I have updated the project documentation as needed.
  • My code has detailed inline documentation.
  • My code is tested to the best of my abilities.
  • My code passes all lints, tests, and checks.
Open WordPress Playground Preview

Copilot AI review requested due to automatic review settings May 8, 2026 06:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SearchTest covering hook registration and selected behaviors for permalinks, author fields, term links, and rendered block rewriting.
  • Add IndexTest covering error returns when prerequisites are missing and verifying Index::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 thread tests/php/Unit/Modules/Search/SearchTest.php Outdated
Comment thread tests/php/Unit/Modules/Search/SearchTest.php
Comment thread tests/php/Unit/Modules/Search/SearchTest.php Outdated
Comment thread tests/php/Unit/Modules/Search/SearchTest.php
Comment thread tests/php/Unit/Modules/Search/IndexTest.php
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread tests/php/Unit/Modules/Search/SettingsTest.php
Comment thread tests/php/Unit/Modules/Search/WatcherTest.php Outdated
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.

2 participants