Skip to content

Tests: Add missing @covers tags for blocks, oembed, and rewrite tests#11532

Open
sagarsdeshmukh wants to merge 1 commit intoWordPress:trunkfrom
sagarsdeshmukh:add-covers-blocks-oembed-rewrite
Open

Tests: Add missing @covers tags for blocks, oembed, and rewrite tests#11532
sagarsdeshmukh wants to merge 1 commit intoWordPress:trunkfrom
sagarsdeshmukh:add-covers-blocks-oembed-rewrite

Conversation

@sagarsdeshmukh
Copy link
Copy Markdown

@sagarsdeshmukh sagarsdeshmukh commented Apr 9, 2026

What

Adds missing @covers annotations to 10 test classes across the blocks, oembed, and rewrite groups, as part of the ongoing effort in #64225.

blocks/

File Annotation added
render.php @covers ::do_blocks
renderReusable.php @covers WP_Block
wpBlockParser.php @covers WP_Block_Parser
wpBlockList.php @covers WP_Block_List
registerBlockTypeFromMetadataWithRegistry.php @covers ::register_block_type_from_metadata

oembed/

File Annotation added
wpOembed.php @covers WP_oEmbed
WpEmbed.php @covers WP_Embed
postEmbedUrl.php @covers ::get_post_embed_url

rewrite/

File Annotation added
permastructs.php @covers ::add_permastruct, @covers ::remove_permastruct
numericSlugs.php @covers ::url_to_postid

Why

Without @covers, PHPUnit cannot correctly attribute code coverage to the functions and classes under test. This leads to inaccurate coverage reports on Codecov, where a function may appear uncovered even when dedicated tests exist for it.

Testing

Ran all 10 affected test classes locally:

npm run test:php -- --filter 
"Tests_Blocks_Render|Tests_Blocks_RenderReusable|Tests_Blocks_wpBlockParser| 
Tests_Blocks_wpBlockList|Tests_Blocks_RegisterBlockTypeFromMetadataWithRegistry| 
Tests_WP_oEmbed|Tests_WP_Embed|Tests_Post_Embed_URL|
Tests_Rewrite_Permastructs|Tests_Rewrite_NumericSlugs"

OK (234 tests, 330 assertions) 

Trac

Follow-up to [62213], [62218], [62222].

Fixes https://core.trac.wordpress.org/ticket/64225

@sagarsdeshmukh sagarsdeshmukh changed the title Tests: Add missing @covers tags for blocks, oembed, and rewrite tests. Tests: Add missing @covers tags for blocks, oembed, and rewrite tests Apr 9, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sagardeshmukh.

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

Follow-up to [62213], [62218], [62222].

See #64225.
@sagarsdeshmukh sagarsdeshmukh force-pushed the add-covers-blocks-oembed-rewrite branch from 2239c96 to 44daed3 Compare April 20, 2026 09:41
@github-actions
Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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