Skip to content

Conversation

@himanshupathak95
Copy link

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

This PR adds unit tests for the patch present to verify the behavior of comment filtering during exports.

The new test ensures that when comments are filtered out using get_comment filter, no empty <wp:comment> tags appear in the export XML.

Run the tests:

npm run test:php -- --filter=Tests_Admin_ExportWp 

@github-actions
Copy link

github-actions bot commented Feb 23, 2025

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 abcd95, desrosj, mukesh27, westonruter.

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

@github-actions
Copy link

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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • 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.

Copy link
Member

@desrosj desrosj left a comment

Choose a reason for hiding this comment

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

Instead of output buffering within this method, can we utilize the get_the_export() method in this class to instead fetch the entire export XML string? Then the same checks can be performed using xpath().

@himanshupathak95 himanshupathak95 force-pushed the add/61244-empty-comment-export-tests branch from bac329b to 3e99f4c Compare July 3, 2025 08:30
@himanshupathak95
Copy link
Author

can we utilize the get_the_export() method

Yes, I completely missed that. Thanks for pointing out.

@himanshupathak95 himanshupathak95 requested a review from desrosj July 3, 2025 09:04
@himanshupathak95 himanshupathak95 force-pushed the add/61244-empty-comment-export-tests branch from e599235 to 3b0a984 Compare November 20, 2025 06:53
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

This looks good to me, but just a couple suggestions for the tests.

@himanshupathak95 himanshupathak95 force-pushed the add/61244-empty-comment-export-tests branch from 3b0a984 to e2f5e81 Compare November 28, 2025 13:47
@himanshupathak95
Copy link
Author

I think the failing test is unrelated to the changes in the PR.

@westonruter
Copy link
Member

@himanshupathak95 himanshupathak95 force-pushed the add/61244-empty-comment-export-tests branch from e2f5e81 to 141982e Compare December 6, 2025 15:25
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