Skip to content

Tests: Fill global styles REST read-side empty stubs. - #13854

Closed
shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:fix/40538-global-styles-read-side
Closed

shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:fix/40538-global-styles-read-side

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

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

What

Replaces the empty @doesNotPerformAssertions stubs for test_context_param() and test_get_items() in the global styles REST API tests with real assertions.

Why

Per #40538, remaining read-side empty stubs should become real assertions. rest-global-styles-controller.php has two claimable read-side cases. Write-side and prepare_item stubs are left alone pending #66073.

How

In WP_REST_Global_Styles_Controller_Test:

  • test_context_param() — OPTIONS on single and theme global styles routes; assert no context arg
  • test_get_items() — GET /wp/v2/global-styles and assert rest_no_route / 404 (no collection route)

Testing instructions

  1. From the repo root, run:
node ./tools/local-env/scripts/docker.js run --rm php ./vendor/bin/phpunit --filter 'WP_REST_Global_Styles_Controller_Test::test_context_param|WP_REST_Global_Styles_Controller_Test::test_get_items'
  1. Confirm both tests pass and are not reported as risky.

Use of AI Tools

  • Cursor

@shail-mehta
shail-mehta marked this pull request as ready for review September 30, 2026 15:16
@github-actions

github-actions Bot commented Sep 30, 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, lancewillett.

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

@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 OPTIONS checks in test_context_param() exercise registered endpoints and look useful. Please keep those and restore the documented stub for test_get_items().

There is no collection operation here. Checking that its unregistered URL returns 404 tests the router fallback, rather than a global-styles read operation. The ticket guidance permits documenting unsupported operations.

The patch passes locally and CI is green. This should be ready for another look once that scope is trimmed.


Adversarial review · gpt-6

@shail-mehta

Copy link
Copy Markdown
Member Author

Applied changes in latest commit.

wporg-sync pushed a commit that referenced this pull request Sep 30, 2026
Use OPTIONS requests to verify that the single global styles and theme global styles endpoints omit the context argument.

Developed in: #13854

Props shailu25.
See #40538.


git-svn-id: https://develop.svn.wordpress.org/trunk@64020 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Sep 30, 2026
Use OPTIONS requests to verify that the single global styles and theme global styles endpoints omit the context argument.

Developed in: WordPress/wordpress-develop#13854

Props shailu25.
See #40538.

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


git-svn-id: http://core.svn.wordpress.org/trunk@63180 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.

2 participants