Wordpress/tests/qunit
Adam Silverstein 1879140548 REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.

The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.

Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.

Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.

Props jnylen0, welcher.
Fixes #39264.



git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 04:22:32 +00:00
..
editor TiinyMCE: update to 4.4.3, changelog: https://www.tinymce.com/docs/changelog/#version443-september12016 2016-10-11 00:09:03 +00:00
fixtures REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation. 2017-02-14 04:22:32 +00:00
vendor Customizer: Add QUnit tests for menus. 2015-08-03 19:27:27 +00:00
wp-admin/js Menus: trigger an event when menu items are added or removed. 2017-01-20 16:14:23 +00:00
wp-includes/js REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation. 2017-02-14 04:22:32 +00:00
.jshintrc Various JSHint fixes. see #26446. 2014-02-08 00:51:14 +00:00
index.html REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation. 2017-02-14 04:22:32 +00:00