[wp-trac] [WordPress Trac] #57501: Backport the added query args to Pattern_Directory Controller

WordPress Trac noreply at wordpress.org
Fri Jan 20 20:35:54 UTC 2023


#57501: Backport the added query args to Pattern_Directory Controller
-------------------------------------------------+-------------------------
 Reporter:  ntsekouras                           |       Owner:  ntsekouras
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.2
Component:  Editor                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests gutenberg-  |     Focuses:
  merge has-testing-info needs-testing           |
-------------------------------------------------+-------------------------

Comment (by ironprogrammer):

 == Test Report
 ''This is a follow-up to comment:9 with API test results. **tl;dr:** Found
 an issue when modifying `search` queries.''

 Patch tested: https://github.com/WordPress/wordpress-develop/pull/3861

 === Environment
 - Hardware: MacBook Pro Apple M1 Pro
 - OS: macOS 12.6.2
 - Application: Postman 10.8.3
 - Server: nginx/1.23.3
 - PHP: 7.4.33
 - WordPress: 6.2-alpha-54642-src

 === Actual Results
 ==== API Test
 > Test the API endpoint in a REST client.

 1. ✅ Try pagination (`per_page, page, offset`):
     `/wp-json/wp/v2/pattern-directory/patterns/?per_page=6&page=2`
 ''Figure 1''
     `/wp-json/wp/v2/pattern-
 directory/patterns/?per_page=6&page=1&offset=6` ''Figure 2''
 2. ✅ Try order (`orderby, order`):
     `/wp-json/wp/v2/pattern-
 directory/patterns/?category=26&per_page=5&orderby=date&order=asc`
 ''Figure 3''
 3. ❌ Make sure search still works (`search`):
     `/wp-json/wp/v2/pattern-directory/patterns/?search=plants` ''Figure
 4''
     🟢 `search` works alone, and along with the `per_page` and `page`
 parameters.
     🔴 `search` is not affected by the `offset`, `orderby`, or `order`
 parameters. ''Figure 5''
 4. ✅ Make sure slug still works (`slug`):
     `/wp-json/wp/v2/pattern-directory/patterns/?slug=centered-text-title-
 with-two-columns` ''Figure 6''
 5. ✅ When setting parameters with invalid values (e.g. `per_page=200` or
 `orderby=foobar`), the API responds with appropriate errors.

 === Additional Information
 - These tests were performed with Postman and a rudimentary visualizer to
 compare retrieved results with those visible on the
 [https://wordpress.org/patterns/ WordPress.org Patterns directory]. See
 the image artifacts below for comparisons.
 - Re: Test 2 -- The original test instructions included a sample category
 query for footers (37), but there appears to be a problem with the data
 which causes the test to fail. **However, tests with other categories work
 as expected**.

 === Supplemental Artifacts
 ''Click an image to view the large version.''
 ||= Figure 1  =||= Figure 2  =||
 || [[Image(https://cldup.com/mKIbdya9Nu.png)]] ||
 [[Image(https://cldup.com/nL7NeBWgrM.png)]] ||
 || Figure 3 ||= Figure 4 =||
 || [[Image(https://cldup.com/tllvlr_leO.png)]] ||
 [[Image(https://cldup.com/86cy8yDaNp.png)]] ||
 || Figure 5 ||= Figure 6 =||
 || [[Image(https://cldup.com/jAjLvNLCOO.png)]] ||
 [[Image(https://cldup.com/huMzOl_Bk4.png)]] ||

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57501#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list