wordpress-develop icon indicating copy to clipboard operation
wordpress-develop copied to clipboard

Tests: Add unit tests for `object_ids` handling in `WP_Term_Query`

Open himanshupathak95 opened this issue 1 month ago • 4 comments

Trac ticket: https://core.trac.wordpress.org/ticket/63256

Adds unit test coverage for the fix implemented in #8668 that addresses unnecessary array_map() processing in WP_Term_Query::get_terms() when object_ids is not set.

This PR -

  • Verifies that when object_ids is null (default), all terms are returned without filtering
  • Ensures the optimization skips unnecessary array_map() processing
  • Validates that numeric zero (0) is treated as a valid object ID
  • Prevents regression where 0 might be incorrectly treated as empty

Testing

npm run test:php -- --filter=Tests_Term_Query

Follows the patch of https://github.com/WordPress/wordpress-develop/pull/8668 by @dilipbheda

Props: @dilipbheda for the original patch

himanshupathak95 avatar Dec 15 '25 16:12 himanshupathak95