From 1d337dec337ea3fb5106154487bb45e44fa3fd6c Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Tue, 14 Feb 2017 04:23:43 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@40058 git-svn-id: http://core.svn.wordpress.org/trunk@39995 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index d59a9fec4f..b26e2bff59 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-40057'; +$wp_version = '4.8-alpha-40058'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.