Skip to content

Link: Add unit tests for paginate_comments_links() - #14703

Open
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65819-paginate-comments-links
Open

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65819-paginate-comments-links

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

What

Adds unit tests for the paginate_comments_links() function.

Why

paginate_comments_links() had zero unit test coverage in WordPress Core.

How

  • Creates tests/phpunit/tests/link/paginateCommentsLinks.php.
  • Tests that paginate_comments_links() returns null when not on a singular view.
  • Tests generated pagination links using plain permalinks.
  • Tests generated pagination links using pretty permalinks.
  • Tests that paginate_comments_links() echoes output by default.
  • Tests that type => 'array' returns an array of link elements and avoids echoing.
  • Tests that paginate_comments_links() respects the cpage query var when current is omitted.

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

Adds unit tests for `paginate_comments_links()` in `tests/phpunit/tests/link/paginateCommentsLinks.php`.

Covers non-singular early return, plain and pretty permalinks, default echo behavior, returning array format when `type => 'array'`, and respecting the `cpage` query var.

See #65819.
@github-actions

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.

@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.

Thanks! Nice coverage for paginate_comments_links(), including the array type. LGTM.

AI Review: Opus 5.5

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.

2 participants