Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#39399 closed enhancement (fixed)

REST API: Tests for the view or embed response data for the Users Controller are incomplete

Reported by: rachelbaker's profile rachelbaker Owned by: rachelbaker's profile rachelbaker
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch commit
Focuses: Cc:

Description

In WP_Test_REST_Users_Controller->check_user_data() tests for responses without a context = edit are missing assertions for the following:

  • 'email` is not an array key
  • 'registered_date' is not an array key (fix the incorrect registered key that is tested)
  • 'locale' is not an array key (See #38528)

https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests/rest-api/rest-users-controller.php?annotate=blame#L2092

Attachments (2)

39399.patch (1.0 KB) - added by thepelkus 8 years ago.
Adds two new assertions, modifies one assertion, per original ticket description.
39399.2.patch (1.0 KB) - added by thepelkus 8 years ago.
Same changes as original patch, but with change direction corrected (i.e. reversed).

Download all attachments as: .zip

Change History (8)

@thepelkus
8 years ago

Adds two new assertions, modifies one assertion, per original ticket description.

#1 @thepelkus
8 years ago

  • Keywords has-patch added; needs-patch removed

I've submitted a patch that I think addresses the issue as described in the ticket. This is my first patch, so please let me know if there's anything else that I should do / something that I should've done instead of what I did!

#2 @jnylen0
8 years ago

Thanks for the patch, @thepelkus! The changes look correct to me, but the patch file itself is reversed (click on 39399.patch and note that the assertions you added show in red, when they should be in green).

This is probably an issue with the git diff command that you used to prepare the patch file.

@thepelkus
8 years ago

Same changes as original patch, but with change direction corrected (i.e. reversed).

#3 @thepelkus
8 years ago

Ha, thanks for pointing that out @jnylen0! New patch submitted that should be going in the right direction.

#4 @jnylen0
8 years ago

Looks good to me 👍

#5 @rachelbaker
8 years ago

  • Keywords commit added; good-first-bug removed
  • Owner set to rachelbaker
  • Status changed from new to reviewing

#6 @rachelbaker
8 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 39660:

REST API: Add missing assertions to the view and embed context response data for the Users Controller.

Adds tests for responses where context != 'edit' the following properties are not included in the response data:

  • email
  • locale
  • registered_date

Props thepelkus, jnylen0.
Fixes #39399.

Note: See TracTickets for help on using tickets.