Skip to content

Tests: Add unit tests for wp_finalize_scraping_edited_file_errors() - #14479

Closed
shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:65819-add-wp-finalize-scraping-edited-file-errors-tests
Closed

shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:65819-add-wp-finalize-scraping-edited-file-errors-tests

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Adds unit tests for wp_finalize_scraping_edited_file_errors() in tests/phpunit/tests/load/wpFinalizeScrapingEditedFileErrors.php.

Covers the success markers, non-fatal error_get_last() values, and the scrape key in the output.

Test-only change.

Why

This helper has had no dedicated PHPUnit coverage. Fits the #65819 missing-coverage track, and no open PR covers it.

How

  • Assert the success payload wraps true in the scrape markers
  • Confirm non-fatal errors still output true
  • Confirm the provided scrape key appears in the start/end markers

Testing instructions

npm run test:php -- --filter Tests_Load_WpFinalizeScrapingEditedFileErrors

Use of AI Tools

  • Cursor

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

The focused test-only changes have no identified blocking issues; tests were not executed.

No open issues 🎉

What changed in this PR

Adds dedicated PHPUnit coverage for wp_finalize_scraping_edited_file_errors() as part of the missing-coverage work in Trac #65819. No production code changes.

Changes:

  • Tests the success payload and handling of non-fatal errors.
  • Verifies the supplied scrape key appears in both output markers.
File Description
tests/​phpunit/​tests/​load/​wpFinalizeScrapingEditedFileErrors.php Adds three isolated tests for output and scrape markers.

Review effort: Balanced

@shail-mehta
shail-mehta marked this pull request as ready for review October 19, 2026 08:44
@github-actions

github-actions Bot commented Oct 19, 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. 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 shailu25, mukesh27.

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

@mukeshpanchal27 mukeshpanchal27 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 expected markers match wp_finalize_scraping_edited_file_errors(). One suggestion inline.

/**
* @ticket 65819
*
* @runInSeparateProcess

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 separate process only gives each test an empty error_get_last(). Calling error_clear_last(); at the start of each test does the same in the normal process, so the three @runInSeparateProcess annotations could go. Also, test_uses_the_provided_scrape_key_in_markers() mostly repeats this test with a different key.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in cb12020

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

The focused tests match the helper’s behavior, clean up error state, and have no identified blocking issues.

No open issues 🎉

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 output-marker assertions and error-state cleanup look correct.

The unit-tests audit is complete. This class passed independently, and the ten-PR batch passed randomized single-site and multisite runs (61 tests, 95 assertions each). PHPCS passed. I also reviewed the fresh Copilot feedback.

AI review · gpt-6

@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit that referenced this pull request Oct 19, 2026
Add coverage for the output markers and nonfatal error handling in `wp_finalize_scraping_edited_file_errors()`.

Developed in: #14479

Props shailu25, mukesh27.
See #65819.


git-svn-id: https://develop.svn.wordpress.org/trunk@64558 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 19, 2026
Add coverage for the output markers and nonfatal error handling in `wp_finalize_scraping_edited_file_errors()`.

Developed in: WordPress/wordpress-develop#14479

Props shailu25, mukesh27.
See #65819.

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


git-svn-id: http://core.svn.wordpress.org/trunk@63708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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