Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#53303 closed enhancement (fixed)

Widget type REST API endpoint should be sorted by id

Reported by: spacedmonkey Owned by: TimothyBlynJacobs
Priority: normal Milestone: 5.9
Component: REST API Version: 5.8
Severity: normal Keywords: has-patch has-unit-tests early
Cc: Focuses: rest-api

Description

The results of Widget type REST API endpoint should be sorted by widget type id to make the output more readable.

Change History (17)

This ticket was mentioned in ​PR #1321 on ​WordPress/wordpress-develop by ​spacedmonkey.


5 years ago
#1

  • Keywords has-patch added; needs-patch removed

#2 @spacedmonkey
5 years ago

@TimothyBlynJacobs Any chance of a review?

​TimothyBJacobs commented on ​PR #1321:


5 years ago
#3

lgtm, can you add a test?

​spacedmonkey commented on ​PR #1321:


5 years ago
#4

lgtm, can you add a test?

You know I looked into a test, but couldn't think of a good one. Any thoughts?

#5 @hellofromTonya
5 years ago

  • Keywords needs-unit-tests added
  • Milestone 5.8 → 5.9

Today is 5.8 Beta 1. As work continues, punting to 5.9.

​spacedmonkey commented on ​PR #1321:


5 years ago
#6

@TimothyBJacobs What tests should I add?

#7 @spacedmonkey
5 years ago

@hellofromTonya I personally think this not being sorted correctly is a bug. It is a one liner that doesn't really need test IMO.

​TimothyBJacobs commented on ​PR #1321:


5 years ago
#8

Sorry for not getting back to you earlier. I'd probably just ksort the result in the tests and assert that it is the same as the returned, non-sorted version.

​spacedmonkey commented on ​PR #1321:


5 years ago
#9

@TimothyBJacobs I have added a unit test.

#10 @spacedmonkey
5 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

#11 @spacedmonkey
5 years ago

  • Keywords early added

#12 @spacedmonkey
5 years ago

@TimothyBlynJacobs Any chance of review / merge.

This ticket was mentioned in ​Slack in #core-restapi by spacedmonkey. ​View the logs.


5 years ago

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


5 years ago

#15 @audrasjb
5 years ago

This ticket was reviewed during today's #core bug scrub.

FWIW, just mentioning that a comment was added in the PR @spacedmonkey :)

This test feels very fragile, it will require updating whenever we introduce or remove a new widget. Can we instead assert that the response is sorted?

#16 @TimothyBlynJacobs
5 years ago

  • Owner set to TimothyBlynJacobs
  • Resolution → fixed
  • Status new → closed

In 51882:

REST API: Sort widget types by their id.

Fixes #53303.
Props spacedmonkey.

Note: See TracTickets for help on using tickets.