Skip to content

Notes: Fix PHPUnit tests - #72781

Merged
Mamaduka merged 1 commit into
trunkfrom
fix/notes-php-unit-tests
Oct 29, 2025
Merged

Mamaduka merged 1 commit into
trunkfrom
fix/notes-php-unit-tests

Conversation

@Mamaduka

Copy link
Copy Markdown
Member

What?

Noticed while testing WordPress/wordpress-develop#10430.

The PHPUnit tests weren't running after changes were backported from core. The test files in this repo require a -test.php suffix.

Testing Instructions

// Should run tests successfully
npm run test:unit:php:base -- --filter WP_Test_REST_Comments_Controller_Gutenberg

@Mamaduka Mamaduka self-assigned this Oct 29, 2025
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting labels Oct 29, 2025
@github-actions

github-actions Bot commented Oct 29, 2025 •

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>

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

@Mamaduka
Mamaduka requested a review from t-hamano October 29, 2025 12:28
* @package Gutenberg
*/
class WP_Test_REST_Comments_Controller_Gutenberg extends WP_Test_REST_Controller_Testcase {
class WP_Test_REST_Comments_Controller_Gutenberg extends WP_Test_REST_TestCase {

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.

Changed this back to WP_Test_REST_TestCase. The controller testcase has a couple of abstract methods that we don't need for testing.

Comment on lines +44 to +50
self::$user_ids = array(
'administrator' => self::$admin_id,
'editor' => self::$editor_id,
'contributor' => self::$contributor_id,
'subscriber' => self::$subscriber_id,
'author' => self::$author_id,
);

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.

This map was missing and failing tests.

@github-actions

Copy link
Copy Markdown

Flaky tests detected in 29c3d8a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18907863337
📝 Reported issues:

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

Good catch!

@Mamaduka

Copy link
Copy Markdown
Member Author

Thanks, @adamsilverstein! Going to merge this.

@Mamaduka
Mamaduka merged commit e717aad into trunk Oct 29, 2025
@Mamaduka
Mamaduka deleted the fix/notes-php-unit-tests branch October 29, 2025 13:22
@github-actions github-actions Bot added this to the Gutenberg 22.0 milestone Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants