wordpress-develop
wordpress-develop copied to clipboard
Tests: Add unit tests for `object_ids` handling in `WP_Term_Query`
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_idsisnull(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
0might 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