[wp-trac] [WordPress Trac] #39264: Add WP-API JS Client unit tests to core

WordPress Trac noreply at wordpress.org
Tue Feb 14 09:07:47 UTC 2017


#39264: Add WP-API JS Client unit tests to core
--------------------------------------+------------------------------
 Reporter:  adamsilverstein           |       Owner:  adamsilverstein
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:  4.7.3
Component:  REST API                  |     Version:  4.7
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  javascript
--------------------------------------+------------------------------

Comment (by jnylen0):

 [attachment:39264.9.diff] should be a workable approach for the first
 issue:

 - Set a lot more properties on our test objects - things like title,
 content, and excerpt - to ensure that they won't change between test runs.
 - Remove meta keys added by another test file.  This was causing several
 properties to show up in the `meta` field of posts during full test suite
 runs, but not during runs of just the `WP_Test_REST_Schema_Initialization`
 class.
 - For any properties that can't be easily controlled (object IDs and
 derivatives like `link`), look through the fixtures array and replace them
 with a set of fixed values (`self::$fixture_replacements` in the patch).

 Also generate the fixture file with `JSON_PRETTY_PRINT` so that future
 diffs are easier to follow.  I didn't include the diff of the fixture file
 here because it is huge.

 Next I'll provide some details about how I created the
 `self::$fixture_replacements` array.

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


More information about the wp-trac mailing list