Skip to content

Tests: Cover next_post_rel_link() and prev_post_rel_link() - #15323

Closed
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65819-cover-next-prev-post-rel-link
Closed

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65819-cover-next-prev-post-rel-link

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

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

This PR extends Tests_Link_GetAdjacentPostRelLink to cover next_post_rel_link() and prev_post_rel_link() for outputting relational links to adjacent posts.

@github-actions

github-actions Bot commented Nov 1, 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 devmuhib.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the added next- and previous-post relational-link tests.

No open issues 🎉

What changed in this PR

Extends WordPress’s adjacent-post relational-link tests to cover output from next_post_rel_link() and prev_post_rel_link(), supporting Trac ticket #65819.

Changes:

  • Adds tests asserting the exact next and previous relational links from the middle post.
  • Updates the class documentation and coverage annotations to include both functions.
File Description
tests/​phpunit/​tests/​link/​getAdjacentPostRelLink.php Adds output assertions for both directional link functions and updates coverage annotations.

Review effort: Balanced

@huzaifaalmesbah huzaifaalmesbah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I left a few small notes inline.

AI Review: Opus 5.5

$expected = "<link rel='next' title='Third Post' href='" . home_url( '?p=' . self::$post_ids[2] ) . "' />\n";

$this->expectOutputString( $expected );
next_post_rel_link();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one looks like a small coverage gap: both tests use the defaults, so they still pass if $title, $in_same_term or $excluded_terms stop being forwarded. Could you add a case with a custom title, like next_post_rel_link( 'Go to %title' ), and the same for prev_post_rel_link()?

*
* @ticket 65819
*
* @covers ::next_post_rel_link

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Optional: the class docblock already has these @covers tags. Feel free to drop this one and the one at line 157.

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the changed code against the implementation and existing coverage; no blocking issue found.

Validated with the related behavioral coverage patches on current trunk: 35 tests / 43 assertions in each of single-site and multisite, randomized seed 1101. No failures, errors, warnings, or skips.

Current-head CI and Copilot review checked.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Nov 1, 2026
Verify that `next_post_rel_link()` and `prev_post_rel_link()` output the corresponding adjacent-post relation links.

Developed in: #15323

Props devmuhib, huzaifaalmesbah.
See #65819.


git-svn-id: https://develop.svn.wordpress.org/trunk@65173 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 1, 2026
Verify that `next_post_rel_link()` and `prev_post_rel_link()` output the corresponding adjacent-post relation links.

Developed in: WordPress/wordpress-develop#15323

Props devmuhib, huzaifaalmesbah.
See #65819.

Built from https://develop.svn.wordpress.org/trunk@65173


git-svn-id: http://core.svn.wordpress.org/trunk@64322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@lancewillett

Copy link
Copy Markdown
Member

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.

4 participants