Repository navigation
Conversation
… block. See #66545.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
There was a problem hiding this comment.
🟡 Changes recommended
The tests leave altered block registry state for subsequent tests and fail to detect regressions in built-in taxonomy prioritization.
2 open issues
What changed in this PR
Adds PHPUnit coverage for the Post Terms block’s server-side rendering, taxonomy variations, and registration callbacks, without changing production code.
Changes:
- Tests term rendering, empty-output conditions, separators, prefix/suffix sanitization, and CSS classes.
- Checks taxonomy variation eligibility, fields, ordering, and defaults.
- Verifies the registered render and variation callbacks.
| File | Description |
|---|---|
tests/phpunit/tests/blocks/renderPostTerms.php |
Adds fixtures and tests for Post Terms rendering, variations, and registration. |
Review effort: Balanced
…s variations with a custom taxonomy first. See #66545.


Adds unit tests for
render_block_core_post_terms(),block_core_post_terms_build_variations()andregister_block_core_post_terms()insrc/wp-includes/blocks/post-terms.php, which were not referenced by any test. No behavior is changed. This is the second part of the ticket: the Post Time To Read block is covered in a separate pull request.The new test class
tests/phpunit/tests/blocks/renderPostTerms.php(23 tests) covers:rel="tag") separated by the separator of the block (a space by default, escaped).wp_kses_post(), and not added when they are empty).taxonomy-<term>,has-text-align-*,has-link-color, both together, and for another taxonomy.isActiveand scope), none for the others, the built-in taxonomies first, and only the category as the default.Testing:
vendor/bin/phpunit --filter 'Tests_Blocks_RenderPostTerms::'vendor/bin/phpunit -c tests/phpunit/multisite.xml --filter 'Tests_Blocks_RenderPostTerms::'vendor/bin/phpcs tests/phpunit/tests/blocks/renderPostTerms.phpI also temporarily broke the functions (each check of the post, the taxonomy and its view, each class, the separator and its escaping, the prefix and the suffix and their cleaning and order, the post of the list, the check of an empty list, the conditions of the variations, their fields and order, and the two callbacks) and confirmed that a new test fails for each one, except for the check of the built-in taxonomies, which does not change the order because the built-in taxonomies are always registered first.
Trac ticket: https://core.trac.wordpress.org/ticket/66545
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5.5
Used for: Written with AI and manually reviewed by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.