Skip to content

Tests: Add types and docblocks to wpTexturize and wpHtmlSplit tests - #14898

Closed
nickchomey wants to merge 1 commit into
WordPress:trunkfrom
nickchomey:63997-test-types
Closed

nickchomey wants to merge 1 commit into
WordPress:trunkfrom
nickchomey:63997-test-types

Conversation

@nickchomey

Copy link
Copy Markdown

Adds parameter and return types plus @param/@return docblocks to the tests and data providers in tests/phpunit/tests/formatting/wpTexturize.php and wpHtmlSplit.php, and to data_whole_posts() in tests/phpunit/data/formatting/whole-posts.php. Tests that returned assertSame()'s void result no longer do. There are no behavior changes, and trunk's static data providers are kept.

This was split out of #12403 at @dmsnell's request, so the regex fix there can land or be reverted on its own. The two PRs don't depend on each other. Whichever lands second will conflict on the docblock above data_whole_posts() in wpTexturize.php, and it's resolved by keeping both sides.

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

Use of AI Tools

AI assistance: Yes
Tool(s): OpenCode
Model(s): Claude Opus 5.5
Used for: Splitting the type and docblock changes out of #12403 and rebasing them onto trunk. I reviewed the result.


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.

Adds parameter and return types plus @param/@return docblocks to the
tests and data providers in tests/phpunit/tests/formatting/wpTexturize.php
and wpHtmlSplit.php, and the whole-posts.php data function. Tests that
returned assertSame()'s void result no longer do. No behavior change.

Split out of WordPress#12403 at reviewer request so the regex fix can land or be
reverted independently.

See #63997.
@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 nickchomey.

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 block approval of the test typing and documentation updates.

No open issues 🎉

What changed in this PR

This PR adds types and documentation to WordPress’s text formatting tests, separating the cleanup from the regex fix in #12403. Production formatting behavior and test expectations remain unchanged.

Changes:

  • Add parameter and return types, test descriptions, and data-provider docblocks.
  • Remove returns of void assertion results while preserving static data providers.
  • Add a get_html_split_regex() coverage annotation to the texturization performance test.
File Description
tests/​phpunit/​tests/​formatting/​wpTexturize.php Type and document tests and providers; remove assertion-result returns and extend coverage metadata.
tests/​phpunit/​tests/​formatting/​wpHtmlSplit.php Type and document tests and providers; remove assertion-result returns.
tests/​phpunit/​data/​formatting/​whole-posts.php Add an array return type and return-shape documentation to the shared provider.

Review effort: Balanced

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

The type declarations match the existing provider data, static providers are preserved, and expected values are unchanged. The affected classes pass before and after the patch on single-site and multisite, including three randomized orders after applying it. PHPCS and current CI pass; Copilot has no findings. Keeping this separate from the regex fix makes the changes independently reviewable.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Oct 30, 2026
Add parameter and return types and document provider array shapes in the `wptexturize()` and `wp_html_split()` tests and their shared whole-post fixture. Remove returns of void assertion results while preserving the existing cases and expected values.

Developed in: #14898

Props nickchomey.
See #63997.


git-svn-id: https://develop.svn.wordpress.org/trunk@65086 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 30, 2026
Add parameter and return types and document provider array shapes in the `wptexturize()` and `wp_html_split()` tests and their shared whole-post fixture. Remove returns of void assertion results while preserving the existing cases and expected values.

Developed in: WordPress/wordpress-develop#14898

Props nickchomey.
See #63997.

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


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

Copy link
Copy Markdown
Member

PR #14898 landed in https://core.trac.wordpress.org/changeset/65086

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.

3 participants