Changeset 43442
- Timestamp:
- 07/13/2018 06:13:27 AM (6 years ago)
- Location:
- branches/4.9
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r43438 r43442 1668 1668 1669 1669 if ( in_array( $post->post_type, array( 'post', 'page' ), true ) || post_type_supports( $post->post_type, 'revisions' ) ) { 1670 $revisions = wp_get_post_revisions( $post->ID, array( 'fields' => 'ids' ) ); 1671 $revisions_count = count( $revisions ); 1672 1670 1673 $links['version-history'] = array( 1671 'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions' ), 1672 ); 1674 'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions' ), 1675 'count' => $revisions_count, 1676 ); 1677 1678 if ( $revisions_count > 0 ) { 1679 $last_revision = array_shift( $revisions ); 1680 1681 $links['predecessor-version'] = array( 1682 'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions/' . $last_revision ), 1683 'id' => $last_revision, 1684 ); 1685 } 1686 1673 1687 } 1674 1688 -
branches/4.9/tests/phpunit/tests/rest-api/rest-posts-controller.php
r43438 r43442 1091 1091 1092 1092 $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions' ), $links['version-history'][0]['href'] ); 1093 $this->assertEquals( 0, $links['version-history'][0]['attributes']['count'] ); 1094 $this->assertFalse( isset( $links['predecessor-version'] ) ); 1093 1095 1094 1096 $attachments_url = rest_url( '/wp/v2/media' ); … … 1116 1118 $category_url = add_query_arg( 'post', self::$post_id, rest_url( '/wp/v2/categories' ) ); 1117 1119 $this->assertEquals( $category_url, $cat_link['href'] ); 1120 } 1121 1122 public function test_get_item_links_predecessor() { 1123 wp_update_post( 1124 array( 1125 'post_content' => 'This content is marvelous.', 1126 'ID' => self::$post_id, 1127 ) 1128 ); 1129 $revisions = wp_get_post_revisions( self::$post_id ); 1130 $revision_1 = array_pop( $revisions ); 1131 1132 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); 1133 $response = rest_get_server()->dispatch( $request ); 1134 1135 $links = $response->get_links(); 1136 1137 $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions' ), $links['version-history'][0]['href'] ); 1138 $this->assertEquals( 1, $links['version-history'][0]['attributes']['count'] ); 1139 1140 $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions/' . $revision_1->ID ), $links['predecessor-version'][0]['href'] ); 1141 $this->assertEquals( $revision_1->ID, $links['predecessor-version'][0]['attributes']['id'] ); 1118 1142 } 1119 1143 -
branches/4.9/tests/phpunit/tests/rest-api/rest-schema-setup.php
r41678 r43442 426 426 'oembeds.author_url' => 'http://example.org', 427 427 'oembeds.html' => '<blockquote class="wp-embedded-content">...</blockquote>...', 428 'PostsCollection.0.id' => 3,429 'PostsCollection.0.guid.rendered' => 'http://example.org/?p= 3',430 'PostsCollection.0.link' => 'http://example.org/?p= 3',431 'PostsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/ 3',428 'PostsCollection.0.id' => 4, 429 'PostsCollection.0.guid.rendered' => 'http://example.org/?p=4', 430 'PostsCollection.0.link' => 'http://example.org/?p=4', 431 'PostsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4', 432 432 'PostsCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts', 433 433 'PostsCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/post', 434 'PostsCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3', 435 'PostsCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3/revisions', 436 'PostsCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3', 437 'PostsCollection.0._links.wp:term.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3', 438 'PostsCollection.0._links.wp:term.1.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3', 439 'PostModel.id' => 3, 440 'PostModel.guid.rendered' => 'http://example.org/?p=3', 441 'PostModel.link' => 'http://example.org/?p=3', 434 'PostsCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4', 435 'PostsCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions', 436 'PostsCollection.0._links.predecessor-version.0.id' => 5, 437 'PostsCollection.0._links.predecessor-version.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions/5', 438 'PostsCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4', 439 'PostsCollection.0._links.wp:term.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4', 440 'PostsCollection.0._links.wp:term.1.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4', 441 'PostModel.id' => 4, 442 'PostModel.guid.rendered' => 'http://example.org/?p=4', 443 'PostModel.link' => 'http://example.org/?p=4', 442 444 'postRevisions.0.author' => 2, 443 'postRevisions.0.id' => 4,444 'postRevisions.0.parent' => 3,445 'postRevisions.0.slug' => ' 3-revision-v1',446 'postRevisions.0.guid.rendered' => 'http://example.org/?p= 4',447 'postRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/ 3',445 'postRevisions.0.id' => 5, 446 'postRevisions.0.parent' => 4, 447 'postRevisions.0.slug' => '4-revision-v1', 448 'postRevisions.0.guid.rendered' => 'http://example.org/?p=5', 449 'postRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4', 448 450 'revision.author' => 2, 449 'revision.id' => 4,450 'revision.parent' => 3,451 'revision.slug' => ' 3-revision-v1',452 'revision.guid.rendered' => 'http://example.org/?p= 4',453 'PagesCollection.0.id' => 5,454 'PagesCollection.0.guid.rendered' => 'http://example.org/?page_id= 5',455 'PagesCollection.0.link' => 'http://example.org/?page_id= 5',456 'PagesCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/ 5',451 'revision.id' => 5, 452 'revision.parent' => 4, 453 'revision.slug' => '4-revision-v1', 454 'revision.guid.rendered' => 'http://example.org/?p=5', 455 'PagesCollection.0.id' => 6, 456 'PagesCollection.0.guid.rendered' => 'http://example.org/?page_id=6', 457 'PagesCollection.0.link' => 'http://example.org/?page_id=6', 458 'PagesCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6', 457 459 'PagesCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages', 458 460 'PagesCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/page', 459 'PagesCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5', 460 'PagesCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/5/revisions', 461 'PagesCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5', 462 'PageModel.id' => 5, 463 'PageModel.guid.rendered' => 'http://example.org/?page_id=5', 464 'PageModel.link' => 'http://example.org/?page_id=5', 461 'PagesCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6', 462 'PagesCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions', 463 'PagesCollection.0._links.predecessor-version.0.id' => 7, 464 'PagesCollection.0._links.predecessor-version.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions/7', 465 'PagesCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6', 466 'PageModel.id' => 6, 467 'PageModel.guid.rendered' => 'http://example.org/?page_id=6', 468 'PageModel.link' => 'http://example.org/?page_id=6', 465 469 'pageRevisions.0.author' => 2, 466 'pageRevisions.0.id' => 6,467 'pageRevisions.0.parent' => 5,468 'pageRevisions.0.slug' => ' 5-revision-v1',469 'pageRevisions.0.guid.rendered' => 'http://example.org/?p= 6',470 'pageRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/ 5',470 'pageRevisions.0.id' => 7, 471 'pageRevisions.0.parent' => 6, 472 'pageRevisions.0.slug' => '6-revision-v1', 473 'pageRevisions.0.guid.rendered' => 'http://example.org/?p=7', 474 'pageRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6', 471 475 'pageRevision.author' => 2, 472 'pageRevision.id' => 6,473 'pageRevision.parent' => 5,474 'pageRevision.slug' => ' 5-revision-v1',475 'pageRevision.guid.rendered' => 'http://example.org/?p= 6',476 'MediaCollection.0.id' => 7,477 'MediaCollection.0.guid.rendered' => 'http://example.org/?attachment_id= 7',478 'MediaCollection.0.link' => 'http://example.org/?attachment_id= 7',476 'pageRevision.id' => 7, 477 'pageRevision.parent' => 6, 478 'pageRevision.slug' => '6-revision-v1', 479 'pageRevision.guid.rendered' => 'http://example.org/?p=7', 480 'MediaCollection.0.id' => 8, 481 'MediaCollection.0.guid.rendered' => 'http://example.org/?attachment_id=8', 482 'MediaCollection.0.link' => 'http://example.org/?attachment_id=8', 479 483 'MediaCollection.0.description.rendered' => '<p class="attachment"><!-- <a...><img.../></a> --></p>', 480 484 'MediaCollection.0.source_url' => 'http://example.org/wp-content/uploads//tmp/canola.jpg', 481 'MediaCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media/ 7',485 'MediaCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media/8', 482 486 'MediaCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media', 483 487 'MediaCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/attachment', 484 'MediaCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post= 7',485 'MediaModel.id' => 7,486 'MediaModel.guid.rendered' => 'http://example.org/?attachment_id= 7',487 'MediaModel.link' => 'http://example.org/?attachment_id= 7',488 'MediaCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8', 489 'MediaModel.id' => 8, 490 'MediaModel.guid.rendered' => 'http://example.org/?attachment_id=8', 491 'MediaModel.link' => 'http://example.org/?attachment_id=8', 488 492 'MediaModel.description.rendered' => '<p class="attachment"><!-- <a...><img.../></a> --></p>', 489 493 'MediaModel.source_url' => 'http://example.org/wp-content/uploads//tmp/canola.jpg', … … 533 537 'me.link' => 'http://example.org/?author=2', 534 538 'CommentsCollection.0.id' => 2, 535 'CommentsCollection.0.post' => 3,536 'CommentsCollection.0.link' => 'http://example.org/?p= 3#comment-2',539 'CommentsCollection.0.post' => 4, 540 'CommentsCollection.0.link' => 'http://example.org/?p=4#comment-2', 537 541 'CommentsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/comments/2', 538 542 'CommentsCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/comments', 539 'CommentsCollection.0._links.up.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/ 3',543 'CommentsCollection.0._links.up.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4', 540 544 'CommentModel.id' => 2, 541 'CommentModel.post' => 3,542 'CommentModel.link' => 'http://example.org/?p= 3#comment-2',545 'CommentModel.post' => 4, 546 'CommentModel.link' => 'http://example.org/?p=4#comment-2', 543 547 'settings.title' => 'Test Blog', 544 548 'settings.url' => 'http://example.org', -
branches/4.9/tests/qunit/fixtures/wp-api-generated.js
r43072 r43442 3535 3535 mockedApiResponse.PostsCollection = [ 3536 3536 { 3537 "id": 3,3537 "id": 4, 3538 3538 "date": "2017-02-14T00:00:00", 3539 3539 "date_gmt": "2017-02-14T00:00:00", 3540 3540 "guid": { 3541 "rendered": "http://example.org/?p= 3"3541 "rendered": "http://example.org/?p=4" 3542 3542 }, 3543 3543 "modified": "2017-02-14T00:00:00", … … 3546 3546 "status": "publish", 3547 3547 "type": "post", 3548 "link": "http://example.org/?p= 3",3548 "link": "http://example.org/?p=4", 3549 3549 "title": { 3550 3550 "rendered": "REST API Client Fixture: Post" … … 3575 3575 "self": [ 3576 3576 { 3577 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/ 3"3577 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4" 3578 3578 } 3579 3579 ], … … 3591 3591 { 3592 3592 "embeddable": true, 3593 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post= 3"3593 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4" 3594 3594 } 3595 3595 ], 3596 3596 "version-history": [ 3597 3597 { 3598 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3/revisions" 3598 "count": 1, 3599 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions" 3600 } 3601 ], 3602 "predecessor-version": [ 3603 { 3604 "id": 5, 3605 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions/5" 3599 3606 } 3600 3607 ], 3601 3608 "wp:attachment": [ 3602 3609 { 3603 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent= 3"3610 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4" 3604 3611 } 3605 3612 ], … … 3608 3615 "taxonomy": "category", 3609 3616 "embeddable": true, 3610 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post= 3"3617 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4" 3611 3618 }, 3612 3619 { 3613 3620 "taxonomy": "post_tag", 3614 3621 "embeddable": true, 3615 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post= 3"3622 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4" 3616 3623 } 3617 3624 ], … … 3628 3635 3629 3636 mockedApiResponse.PostModel = { 3630 "id": 3,3637 "id": 4, 3631 3638 "date": "2017-02-14T00:00:00", 3632 3639 "date_gmt": "2017-02-14T00:00:00", 3633 3640 "guid": { 3634 "rendered": "http://example.org/?p= 3"3641 "rendered": "http://example.org/?p=4" 3635 3642 }, 3636 3643 "modified": "2017-02-14T00:00:00", … … 3639 3646 "status": "publish", 3640 3647 "type": "post", 3641 "link": "http://example.org/?p= 3",3648 "link": "http://example.org/?p=4", 3642 3649 "title": { 3643 3650 "rendered": "REST API Client Fixture: Post" … … 3672 3679 "date": "2017-02-14T00:00:00", 3673 3680 "date_gmt": "2017-02-14T00:00:00", 3674 "id": 4,3681 "id": 5, 3675 3682 "modified": "2017-02-14T00:00:00", 3676 3683 "modified_gmt": "2017-02-14T00:00:00", 3677 "parent": 3,3678 "slug": " 3-revision-v1",3684 "parent": 4, 3685 "slug": "4-revision-v1", 3679 3686 "guid": { 3680 "rendered": "http://example.org/?p= 4"3687 "rendered": "http://example.org/?p=5" 3681 3688 }, 3682 3689 "title": { … … 3692 3699 "parent": [ 3693 3700 { 3694 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/ 3"3701 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4" 3695 3702 } 3696 3703 ] … … 3703 3710 "date": "2017-02-14T00:00:00", 3704 3711 "date_gmt": "2017-02-14T00:00:00", 3705 "id": 4,3712 "id": 5, 3706 3713 "modified": "2017-02-14T00:00:00", 3707 3714 "modified_gmt": "2017-02-14T00:00:00", 3708 "parent": 3,3709 "slug": " 3-revision-v1",3715 "parent": 4, 3716 "slug": "4-revision-v1", 3710 3717 "guid": { 3711 "rendered": "http://example.org/?p= 4"3718 "rendered": "http://example.org/?p=5" 3712 3719 }, 3713 3720 "title": { … … 3724 3731 mockedApiResponse.PagesCollection = [ 3725 3732 { 3726 "id": 5,3733 "id": 6, 3727 3734 "date": "2017-02-14T00:00:00", 3728 3735 "date_gmt": "2017-02-14T00:00:00", 3729 3736 "guid": { 3730 "rendered": "http://example.org/?page_id= 5"3737 "rendered": "http://example.org/?page_id=6" 3731 3738 }, 3732 3739 "modified": "2017-02-14T00:00:00", … … 3735 3742 "status": "publish", 3736 3743 "type": "page", 3737 "link": "http://example.org/?page_id= 5",3744 "link": "http://example.org/?page_id=6", 3738 3745 "title": { 3739 3746 "rendered": "REST API Client Fixture: Page" … … 3760 3767 "self": [ 3761 3768 { 3762 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/ 5"3769 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6" 3763 3770 } 3764 3771 ], … … 3776 3783 { 3777 3784 "embeddable": true, 3778 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post= 5"3785 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6" 3779 3786 } 3780 3787 ], 3781 3788 "version-history": [ 3782 3789 { 3783 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/5/revisions" 3790 "count": 1, 3791 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions" 3792 } 3793 ], 3794 "predecessor-version": [ 3795 { 3796 "id": 7, 3797 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions/7" 3784 3798 } 3785 3799 ], 3786 3800 "wp:attachment": [ 3787 3801 { 3788 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent= 5"3802 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6" 3789 3803 } 3790 3804 ], … … 3801 3815 3802 3816 mockedApiResponse.PageModel = { 3803 "id": 5,3817 "id": 6, 3804 3818 "date": "2017-02-14T00:00:00", 3805 3819 "date_gmt": "2017-02-14T00:00:00", 3806 3820 "guid": { 3807 "rendered": "http://example.org/?page_id= 5"3821 "rendered": "http://example.org/?page_id=6" 3808 3822 }, 3809 3823 "modified": "2017-02-14T00:00:00", … … 3812 3826 "status": "publish", 3813 3827 "type": "page", 3814 "link": "http://example.org/?page_id= 5",3828 "link": "http://example.org/?page_id=6", 3815 3829 "title": { 3816 3830 "rendered": "REST API Client Fixture: Page" … … 3841 3855 "date": "2017-02-14T00:00:00", 3842 3856 "date_gmt": "2017-02-14T00:00:00", 3843 "id": 6,3857 "id": 7, 3844 3858 "modified": "2017-02-14T00:00:00", 3845 3859 "modified_gmt": "2017-02-14T00:00:00", 3846 "parent": 5,3847 "slug": " 5-revision-v1",3860 "parent": 6, 3861 "slug": "6-revision-v1", 3848 3862 "guid": { 3849 "rendered": "http://example.org/?p= 6"3863 "rendered": "http://example.org/?p=7" 3850 3864 }, 3851 3865 "title": { … … 3861 3875 "parent": [ 3862 3876 { 3863 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/ 5"3877 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6" 3864 3878 } 3865 3879 ] … … 3872 3886 "date": "2017-02-14T00:00:00", 3873 3887 "date_gmt": "2017-02-14T00:00:00", 3874 "id": 6,3888 "id": 7, 3875 3889 "modified": "2017-02-14T00:00:00", 3876 3890 "modified_gmt": "2017-02-14T00:00:00", 3877 "parent": 5,3878 "slug": " 5-revision-v1",3891 "parent": 6, 3892 "slug": "6-revision-v1", 3879 3893 "guid": { 3880 "rendered": "http://example.org/?p= 6"3894 "rendered": "http://example.org/?p=7" 3881 3895 }, 3882 3896 "title": { … … 3893 3907 mockedApiResponse.MediaCollection = [ 3894 3908 { 3895 "id": 7,3909 "id": 8, 3896 3910 "date": "2017-02-14T00:00:00", 3897 3911 "date_gmt": "2017-02-14T00:00:00", 3898 3912 "guid": { 3899 "rendered": "http://example.org/?attachment_id= 7"3913 "rendered": "http://example.org/?attachment_id=8" 3900 3914 }, 3901 3915 "modified": "2017-02-14T00:00:00", … … 3904 3918 "status": "inherit", 3905 3919 "type": "attachment", 3906 "link": "http://example.org/?attachment_id= 7",3920 "link": "http://example.org/?attachment_id=8", 3907 3921 "title": { 3908 3922 "rendered": "REST API Client Fixture: Attachment" … … 3930 3944 "self": [ 3931 3945 { 3932 "href": "http://example.org/index.php?rest_route=/wp/v2/media/7" 3946 "attributes": [], 3947 "href": "http://example.org/index.php?rest_route=/wp/v2/media/8" 3933 3948 } 3934 3949 ], 3935 3950 "collection": [ 3936 3951 { 3952 "attributes": [], 3937 3953 "href": "http://example.org/index.php?rest_route=/wp/v2/media" 3938 3954 } … … 3940 3956 "about": [ 3941 3957 { 3958 "attributes": [], 3942 3959 "href": "http://example.org/index.php?rest_route=/wp/v2/types/attachment" 3943 3960 } … … 3945 3962 "replies": [ 3946 3963 { 3947 "embeddable": true, 3948 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7" 3964 "attributes": { 3965 "embeddable": true 3966 }, 3967 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8" 3949 3968 } 3950 3969 ] … … 3954 3973 3955 3974 mockedApiResponse.MediaModel = { 3956 "id": 7,3975 "id": 8, 3957 3976 "date": "2017-02-14T00:00:00", 3958 3977 "date_gmt": "2017-02-14T00:00:00", 3959 3978 "guid": { 3960 "rendered": "http://example.org/?attachment_id= 7"3979 "rendered": "http://example.org/?attachment_id=8" 3961 3980 }, 3962 3981 "modified": "2017-02-14T00:00:00", … … 3965 3984 "status": "inherit", 3966 3985 "type": "attachment", 3967 "link": "http://example.org/?attachment_id= 7",3986 "link": "http://example.org/?attachment_id=8", 3968 3987 "title": { 3969 3988 "rendered": "REST API Client Fixture: Attachment" … … 4461 4480 { 4462 4481 "id": 2, 4463 "post": 3,4482 "post": 4, 4464 4483 "parent": 0, 4465 4484 "author": 0, … … 4471 4490 "rendered": "<p>This is a comment</p>\n" 4472 4491 }, 4473 "link": "http://example.org/?p= 3#comment-2",4492 "link": "http://example.org/?p=4#comment-2", 4474 4493 "status": "approved", 4475 4494 "type": "comment", … … 4497 4516 "embeddable": true, 4498 4517 "post_type": "post", 4499 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/ 3"4518 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4" 4500 4519 } 4501 4520 ] … … 4506 4525 mockedApiResponse.CommentModel = { 4507 4526 "id": 2, 4508 "post": 3,4527 "post": 4, 4509 4528 "parent": 0, 4510 4529 "author": 0, … … 4516 4535 "rendered": "<p>This is a comment</p>\n" 4517 4536 }, 4518 "link": "http://example.org/?p= 3#comment-2",4537 "link": "http://example.org/?p=4#comment-2", 4519 4538 "status": "approved", 4520 4539 "type": "comment",
Note: See TracChangeset
for help on using the changeset viewer.