Skip to content

Tests: Add unit tests for the archive breadcrumbs of the Breadcrumbs block - #15785

Closed
hmbashar wants to merge 1 commit into
WordPress:trunkfrom
hmbashar:test-breadcrumbs-archive
Closed

hmbashar wants to merge 1 commit into
WordPress:trunkfrom
hmbashar:test-breadcrumbs-archive

Conversation

@hmbashar

@hmbashar hmbashar commented Nov 7, 2026

Copy link
Copy Markdown

Summary

Adds tests for block_core_breadcrumbs_get_archive_breadcrumbs(), the breadcrumbs of the archives of the Breadcrumbs block, which had no tests. This is the second pull request for the ticket; the first one covers the helper functions.

  • Date archives: the year, the month (with the year linked) and the day (with the year and the month linked), and the date of the m query variable.
  • Term archives: a category with its ancestors, and a tag.
  • Post type archives: the label of the archive, the post_type_archive_title filter (also when it gives an empty title), and a query for several post types.
  • Author archives.
  • Paginated archives: the current item links to the first page and a "Page N" item follows, for each kind of archive.
  • Views without a queried object, and views that are not an archive, have no breadcrumbs except the page number of a paginated single post.

Testing

vendor/bin/phpunit --filter 'Tests_Blocks_BreadcrumbsArchive::'
vendor/bin/phpunit -c tests/phpunit/multisite.xml --filter 'Tests_Blocks_BreadcrumbsArchive::'
vendor/bin/phpcs tests/phpunit/tests/blocks/breadcrumbsArchive.php

Mutation check: 34 changes to the function (every kind of archive, the query variables, the links, the labels, the filter and the pagination) were each caught by a test.

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

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.

@hmbashar
hmbashar marked this pull request as ready for review November 7, 2026 06:26
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

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:

Props hmbashar.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@hmbashar hmbashar closed this Nov 7, 2026
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.

1 participant