diff --git a/tests/phpunit/tests/rest-api/rest-schema-setup.php b/tests/phpunit/tests/rest-api/rest-schema-setup.php index e5b3460122..7af514b299 100644 --- a/tests/phpunit/tests/rest-api/rest-schema-setup.php +++ b/tests/phpunit/tests/rest-api/rest-schema-setup.php @@ -441,66 +441,70 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase { 'oembeds.author_name' => 'Test Blog', 'oembeds.author_url' => 'http://example.org', 'oembeds.html' => '
......', - 'PostsCollection.0.id' => 3, - 'PostsCollection.0.guid.rendered' => 'http://example.org/?p=3', - 'PostsCollection.0.link' => 'http://example.org/?p=3', - 'PostsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3', + 'PostsCollection.0.id' => 4, + 'PostsCollection.0.guid.rendered' => 'http://example.org/?p=4', + 'PostsCollection.0.link' => 'http://example.org/?p=4', + 'PostsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4', 'PostsCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts', 'PostsCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/post', - 'PostsCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3', - 'PostsCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3/revisions', - 'PostsCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3', - 'PostsCollection.0._links.wp:term.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3', - 'PostsCollection.0._links.wp:term.1.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3', - 'PostModel.id' => 3, - 'PostModel.guid.rendered' => 'http://example.org/?p=3', - 'PostModel.link' => 'http://example.org/?p=3', + 'PostsCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4', + 'PostsCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions', + 'PostsCollection.0._links.predecessor-version.0.id' => 5, + 'PostsCollection.0._links.predecessor-version.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions/5', + 'PostsCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4', + 'PostsCollection.0._links.wp:term.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4', + 'PostsCollection.0._links.wp:term.1.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4', + 'PostModel.id' => 4, + 'PostModel.guid.rendered' => 'http://example.org/?p=4', + 'PostModel.link' => 'http://example.org/?p=4', 'postRevisions.0.author' => 2, - 'postRevisions.0.id' => 4, - 'postRevisions.0.parent' => 3, - 'postRevisions.0.slug' => '3-revision-v1', - 'postRevisions.0.guid.rendered' => 'http://example.org/?p=4', - 'postRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3', + 'postRevisions.0.id' => 5, + 'postRevisions.0.parent' => 4, + 'postRevisions.0.slug' => '4-revision-v1', + 'postRevisions.0.guid.rendered' => 'http://example.org/?p=5', + 'postRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4', 'revision.author' => 2, - 'revision.id' => 4, - 'revision.parent' => 3, - 'revision.slug' => '3-revision-v1', - 'revision.guid.rendered' => 'http://example.org/?p=4', - 'PagesCollection.0.id' => 5, - 'PagesCollection.0.guid.rendered' => 'http://example.org/?page_id=5', - 'PagesCollection.0.link' => 'http://example.org/?page_id=5', - 'PagesCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/5', + 'revision.id' => 5, + 'revision.parent' => 4, + 'revision.slug' => '4-revision-v1', + 'revision.guid.rendered' => 'http://example.org/?p=5', + 'PagesCollection.0.id' => 6, + 'PagesCollection.0.guid.rendered' => 'http://example.org/?page_id=6', + 'PagesCollection.0.link' => 'http://example.org/?page_id=6', + 'PagesCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6', 'PagesCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages', 'PagesCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/page', - 'PagesCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5', - 'PagesCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/5/revisions', - 'PagesCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5', - 'PageModel.id' => 5, - 'PageModel.guid.rendered' => 'http://example.org/?page_id=5', - 'PageModel.link' => 'http://example.org/?page_id=5', + 'PagesCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6', + 'PagesCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions', + 'PagesCollection.0._links.predecessor-version.0.id' => 7, + 'PagesCollection.0._links.predecessor-version.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions/7', + 'PagesCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6', + 'PageModel.id' => 6, + 'PageModel.guid.rendered' => 'http://example.org/?page_id=6', + 'PageModel.link' => 'http://example.org/?page_id=6', 'pageRevisions.0.author' => 2, - 'pageRevisions.0.id' => 6, - 'pageRevisions.0.parent' => 5, - 'pageRevisions.0.slug' => '5-revision-v1', - 'pageRevisions.0.guid.rendered' => 'http://example.org/?p=6', - 'pageRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/5', + 'pageRevisions.0.id' => 7, + 'pageRevisions.0.parent' => 6, + 'pageRevisions.0.slug' => '6-revision-v1', + 'pageRevisions.0.guid.rendered' => 'http://example.org/?p=7', + 'pageRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6', 'pageRevision.author' => 2, - 'pageRevision.id' => 6, - 'pageRevision.parent' => 5, - 'pageRevision.slug' => '5-revision-v1', - 'pageRevision.guid.rendered' => 'http://example.org/?p=6', - 'MediaCollection.0.id' => 7, - 'MediaCollection.0.guid.rendered' => 'http://example.org/?attachment_id=7', - 'MediaCollection.0.link' => 'http://example.org/?attachment_id=7', + 'pageRevision.id' => 7, + 'pageRevision.parent' => 6, + 'pageRevision.slug' => '6-revision-v1', + 'pageRevision.guid.rendered' => 'http://example.org/?p=7', + 'MediaCollection.0.id' => 8, + 'MediaCollection.0.guid.rendered' => 'http://example.org/?attachment_id=8', + 'MediaCollection.0.link' => 'http://example.org/?attachment_id=8', 'MediaCollection.0.description.rendered' => '', 'MediaCollection.0.source_url' => 'http://example.org/wp-content/uploads//tmp/canola.jpg', - 'MediaCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media/7', + 'MediaCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media/8', 'MediaCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media', 'MediaCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/attachment', - 'MediaCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7', - 'MediaModel.id' => 7, - 'MediaModel.guid.rendered' => 'http://example.org/?attachment_id=7', - 'MediaModel.link' => 'http://example.org/?attachment_id=7', + 'MediaCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8', + 'MediaModel.id' => 8, + 'MediaModel.guid.rendered' => 'http://example.org/?attachment_id=8', + 'MediaModel.link' => 'http://example.org/?attachment_id=8', 'MediaModel.description.rendered' => '', 'MediaModel.source_url' => 'http://example.org/wp-content/uploads//tmp/canola.jpg', 'TypesCollection.post._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types', @@ -548,14 +552,14 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase { 'me.id' => 2, 'me.link' => 'http://example.org/?author=2', 'CommentsCollection.0.id' => 2, - 'CommentsCollection.0.post' => 3, - 'CommentsCollection.0.link' => 'http://example.org/?p=3#comment-2', + 'CommentsCollection.0.post' => 4, + 'CommentsCollection.0.link' => 'http://example.org/?p=4#comment-2', 'CommentsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/comments/2', 'CommentsCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/comments', - 'CommentsCollection.0._links.up.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3', + 'CommentsCollection.0._links.up.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4', 'CommentModel.id' => 2, - 'CommentModel.post' => 3, - 'CommentModel.link' => 'http://example.org/?p=3#comment-2', + 'CommentModel.post' => 4, + 'CommentModel.link' => 'http://example.org/?p=4#comment-2', 'settings.title' => 'Test Blog', 'settings.url' => 'http://example.org', 'settings.email' => 'admin@example.org', diff --git a/tests/qunit/fixtures/wp-api-generated.js b/tests/qunit/fixtures/wp-api-generated.js index beebbc5270..201481485f 100644 --- a/tests/qunit/fixtures/wp-api-generated.js +++ b/tests/qunit/fixtures/wp-api-generated.js @@ -3542,18 +3542,18 @@ mockedApiResponse.oembedProxy = { mockedApiResponse.PostsCollection = [ { - "id": 3, + "id": 4, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", "guid": { - "rendered": "http://example.org/?p=3" + "rendered": "http://example.org/?p=4" }, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", "slug": "restapi-client-fixture-post", "status": "publish", "type": "post", - "link": "http://example.org/?p=3", + "link": "http://example.org/?p=4", "title": { "rendered": "REST API Client Fixture: Post" }, @@ -3582,7 +3582,7 @@ mockedApiResponse.PostsCollection = [ "_links": { "self": [ { - "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3" + "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4" } ], "collection": [ @@ -3598,36 +3598,36 @@ mockedApiResponse.PostsCollection = [ "replies": [ { "embeddable": true, - "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3" + "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4" } ], "version-history": [ { "count": 1, - "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3/revisions" + "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions" } ], "predecessor-version": [ { - "id": 3123, - "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3122/revisions/3123" + "id": 5, + "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions/5" } ], "wp:attachment": [ { - "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3" + "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4" } ], "wp:term": [ { "taxonomy": "category", "embeddable": true, - "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3" + "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4" }, { "taxonomy": "post_tag", "embeddable": true, - "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3" + "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4" } ], "curies": [ @@ -3642,18 +3642,18 @@ mockedApiResponse.PostsCollection = [ ]; mockedApiResponse.PostModel = { - "id": 3, + "id": 4, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", "guid": { - "rendered": "http://example.org/?p=3" + "rendered": "http://example.org/?p=4" }, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", "slug": "restapi-client-fixture-post", "status": "publish", "type": "post", - "link": "http://example.org/?p=3", + "link": "http://example.org/?p=4", "title": { "rendered": "REST API Client Fixture: Post" }, @@ -3686,13 +3686,13 @@ mockedApiResponse.postRevisions = [ "author": 2, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", - "id": 4, + "id": 5, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", - "parent": 3, - "slug": "3-revision-v1", + "parent": 4, + "slug": "4-revision-v1", "guid": { - "rendered": "http://example.org/?p=4" + "rendered": "http://example.org/?p=5" }, "title": { "rendered": "REST API Client Fixture: Post" @@ -3706,7 +3706,7 @@ mockedApiResponse.postRevisions = [ "_links": { "parent": [ { - "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3" + "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4" } ] } @@ -3717,13 +3717,13 @@ mockedApiResponse.revision = { "author": 2, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", - "id": 4, + "id": 5, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", - "parent": 3, - "slug": "3-revision-v1", + "parent": 4, + "slug": "4-revision-v1", "guid": { - "rendered": "http://example.org/?p=4" + "rendered": "http://example.org/?p=5" }, "title": { "rendered": "REST API Client Fixture: Post" @@ -3738,18 +3738,18 @@ mockedApiResponse.revision = { mockedApiResponse.PagesCollection = [ { - "id": 5, + "id": 6, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", "guid": { - "rendered": "http://example.org/?page_id=5" + "rendered": "http://example.org/?page_id=6" }, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", "slug": "restapi-client-fixture-page", "status": "publish", "type": "page", - "link": "http://example.org/?page_id=5", + "link": "http://example.org/?page_id=6", "title": { "rendered": "REST API Client Fixture: Page" }, @@ -3774,7 +3774,7 @@ mockedApiResponse.PagesCollection = [ "_links": { "self": [ { - "href": "http://example.org/index.php?rest_route=/wp/v2/pages/5" + "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6" } ], "collection": [ @@ -3790,24 +3790,24 @@ mockedApiResponse.PagesCollection = [ "replies": [ { "embeddable": true, - "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5" + "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6" } ], "version-history": [ { "count": 1, - "href": "http://example.org/index.php?rest_route=/wp/v2/pages/5/revisions" + "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions" } ], "predecessor-version": [ { - "id": 3125, - "href": "http://example.org/index.php?rest_route=/wp/v2/pages/3124/revisions/3125" + "id": 7, + "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions/7" } ], "wp:attachment": [ { - "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5" + "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6" } ], "curies": [ @@ -3822,18 +3822,18 @@ mockedApiResponse.PagesCollection = [ ]; mockedApiResponse.PageModel = { - "id": 5, + "id": 6, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", "guid": { - "rendered": "http://example.org/?page_id=5" + "rendered": "http://example.org/?page_id=6" }, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", "slug": "restapi-client-fixture-page", "status": "publish", "type": "page", - "link": "http://example.org/?page_id=5", + "link": "http://example.org/?page_id=6", "title": { "rendered": "REST API Client Fixture: Page" }, @@ -3862,13 +3862,13 @@ mockedApiResponse.pageRevisions = [ "author": 2, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", - "id": 6, + "id": 7, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", - "parent": 5, - "slug": "5-revision-v1", + "parent": 6, + "slug": "6-revision-v1", "guid": { - "rendered": "http://example.org/?p=6" + "rendered": "http://example.org/?p=7" }, "title": { "rendered": "REST API Client Fixture: Page" @@ -3882,7 +3882,7 @@ mockedApiResponse.pageRevisions = [ "_links": { "parent": [ { - "href": "http://example.org/index.php?rest_route=/wp/v2/pages/5" + "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6" } ] } @@ -3893,13 +3893,13 @@ mockedApiResponse.pageRevision = { "author": 2, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", - "id": 6, + "id": 7, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", - "parent": 5, - "slug": "5-revision-v1", + "parent": 6, + "slug": "6-revision-v1", "guid": { - "rendered": "http://example.org/?p=6" + "rendered": "http://example.org/?p=7" }, "title": { "rendered": "REST API Client Fixture: Page" @@ -3914,18 +3914,18 @@ mockedApiResponse.pageRevision = { mockedApiResponse.MediaCollection = [ { - "id": 7, + "id": 8, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", "guid": { - "rendered": "http://example.org/?attachment_id=7" + "rendered": "http://example.org/?attachment_id=8" }, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", "slug": "restapi-client-fixture-attachment", "status": "inherit", "type": "attachment", - "link": "http://example.org/?attachment_id=7", + "link": "http://example.org/?attachment_id=8", "title": { "rendered": "REST API Client Fixture: Attachment" }, @@ -3952,7 +3952,7 @@ mockedApiResponse.MediaCollection = [ "self": [ { "attributes": [], - "href": "http://example.org/index.php?rest_route=/wp/v2/media/7" + "href": "http://example.org/index.php?rest_route=/wp/v2/media/8" } ], "collection": [ @@ -3972,7 +3972,7 @@ mockedApiResponse.MediaCollection = [ "attributes": { "embeddable": true }, - "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7" + "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8" } ] } @@ -3980,18 +3980,18 @@ mockedApiResponse.MediaCollection = [ ]; mockedApiResponse.MediaModel = { - "id": 7, + "id": 8, "date": "2017-02-14T00:00:00", "date_gmt": "2017-02-14T00:00:00", "guid": { - "rendered": "http://example.org/?attachment_id=7" + "rendered": "http://example.org/?attachment_id=8" }, "modified": "2017-02-14T00:00:00", "modified_gmt": "2017-02-14T00:00:00", "slug": "restapi-client-fixture-attachment", "status": "inherit", "type": "attachment", - "link": "http://example.org/?attachment_id=7", + "link": "http://example.org/?attachment_id=8", "title": { "rendered": "REST API Client Fixture: Attachment" }, @@ -4487,7 +4487,7 @@ mockedApiResponse.me = { mockedApiResponse.CommentsCollection = [ { "id": 2, - "post": 3, + "post": 4, "parent": 0, "author": 0, "author_name": "Internet of something or other", @@ -4497,7 +4497,7 @@ mockedApiResponse.CommentsCollection = [ "content": { "rendered": "
This is a comment
\n" }, - "link": "http://example.org/?p=3#comment-2", + "link": "http://example.org/?p=4#comment-2", "status": "approved", "type": "comment", "author_avatar_urls": { @@ -4523,7 +4523,7 @@ mockedApiResponse.CommentsCollection = [ { "embeddable": true, "post_type": "post", - "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3" + "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4" } ] } @@ -4532,7 +4532,7 @@ mockedApiResponse.CommentsCollection = [ mockedApiResponse.CommentModel = { "id": 2, - "post": 3, + "post": 4, "parent": 0, "author": 0, "author_name": "Internet of something or other", @@ -4542,7 +4542,7 @@ mockedApiResponse.CommentModel = { "content": { "rendered": "This is a comment
\n" }, - "link": "http://example.org/?p=3#comment-2", + "link": "http://example.org/?p=4#comment-2", "status": "approved", "type": "comment", "author_avatar_urls": {