Skip to content

Tests: Fill navigation fallback REST read-side empty stubs - #13855

Closed
shail-mehta wants to merge 3 commits into
WordPress:trunkfrom
shail-mehta:fix/40538-navigation-fallback-read-side
Closed

shail-mehta wants to merge 3 commits into
WordPress:trunkfrom
shail-mehta:fix/40538-navigation-fallback-read-side

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

Trac ticket: #40538

What

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

Why

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

How

In WP_REST_Navigation_Fallback_Controller_Test:

  • test_context_param() — OPTIONS /wp-block-editor/v1/navigation-fallback and assert no context arg
  • test_get_items() — GET /wp-block-editor/v1/navigation-fallbacks 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_Navigation_Fallback_Controller_Test::test_context_param|WP_REST_Navigation_Fallback_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:29
@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.

Please keep the OPTIONS assertions in test_context_param(), but leave test_get_items() as an annotated stub with a note that this controller has no collection operation.

The real route is the singleton /wp-block-editor/v1/navigation-fallback. Adding an s creates an unrelated, unregistered URL; its 404 does not exercise the navigation fallback controller. The ticket guidance allows documenting this unsupported operation.

The patch passes locally and CI is green; this request concerns the usefulness of the collection check.


Adversarial review · gpt-6

@shail-mehta

Copy link
Copy Markdown
Member Author

I have applied changes in latest commit.

wporg-sync pushed a commit that referenced this pull request Sep 30, 2026
Verify that OPTIONS exposes no context argument for the navigation fallback endpoint. Document that the controller has no collection operation.

Developed in: #13855

Props shailu25.
See #40538.


git-svn-id: https://develop.svn.wordpress.org/trunk@64021 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
Verify that OPTIONS exposes no context argument for the navigation fallback endpoint. Document that the controller has no collection operation.

Developed in: WordPress/wordpress-develop#13855

Props shailu25.
See #40538.

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


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