Make WordPress Core

Changeset 44126


Ignore:
Timestamp:
12/13/2018 10:41:47 PM (5 years ago)
Author:
desrosj
Message:

REST API: Introduce Autosaves controller and endpoint.

  • Adds WP_REST_Autosaves_Controller which extends WP_REST_Revisions_Controller.
  • Autosaves endpoint is registered for all post types except attachment because even post types without revisions enabled are expected to autosave.
  • Because setting the DOING_AUTOSAVE constant pollutes the test suite, autosaves tests are run last. We may want to improve upon this later.

Also, use a truly impossibly high number in User Controller tests. The number 100, (or 7777 in trunk), could be valid in certain test run configurations. The REST_TESTS_IMPOSSIBLY_HIGH_NUMBER constant is impossibly high for this very reason.

Finally, Skip Autosaves controller test for multisite. There's a PHP 5.2 edge case where paths calculated differently, possibly caused by differing version of PHPUnit.

Props adamsilverstein, aduth, azaozz, danielbachhuber, rmccue, danielbachhuber.

Merges [43767], [43768], [43769] to trunk.

See #45132, #45131.
Fixes #45128, #43316.

Location:
trunk
Files:
8 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/phpunit.xml.dist

    r42665 r44126  
    77    <testsuites>
    88        <!-- Default test suite to run all tests -->
    9         <testsuite>
     9        <testsuite name="default">
    1010            <directory suffix=".php">tests/phpunit/tests</directory>
    1111            <exclude>tests/phpunit/tests/actions/closures.php</exclude>
     
    1414            <exclude>tests/phpunit/tests/image/editorImagick.php</exclude>
    1515            <exclude>tests/phpunit/tests/oembed/headers.php</exclude>
     16            <exclude>tests/phpunit/tests/rest-api/rest-autosaves-controller.php</exclude>
    1617            <file phpVersion="5.3.0">tests/phpunit/tests/actions/closures.php</file>
    1718            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor.php</file>
     
    1920            <file phpVersion="5.3.0">tests/phpunit/tests/image/editorImagick.php</file>
    2021            <file phpVersion="5.3.0">tests/phpunit/tests/oembed/headers.php</file>
     22        </testsuite>
     23        <!-- Sets the DOING_AUTOSAVE constant, so needs to be run last -->
     24        <testsuite name="restapi-autosave">
     25            <file>tests/phpunit/tests/rest-api/rest-autosaves-controller.php</file>
    2126        </testsuite>
    2227    </testsuites>
  • trunk/src/wp-includes/rest-api.php

    r44123 r44126  
    193193            $revisions_controller = new WP_REST_Revisions_Controller( $post_type->name );
    194194            $revisions_controller->register_routes();
     195        }
     196
     197        if ( 'attachment' !== $post_type->name ) {
     198            $autosaves_controller = new WP_REST_Autosaves_Controller( $post_type->name );
     199            $autosaves_controller->register_routes();
    195200        }
    196201    }
  • trunk/src/wp-settings.php

    r44118 r44126  
    231231require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php' );
    232232require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-revisions-controller.php' );
     233require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-autosaves-controller.php' );
    233234require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-taxonomies-controller.php' );
    234235require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-terms-controller.php' );
  • trunk/tests/phpunit/multisite.xml

    r41263 r44126  
    1010    <testsuites>
    1111        <!-- Default test suite to run all tests -->
    12         <testsuite>
     12        <testsuite name="default">
    1313            <directory suffix=".php">tests</directory>
    1414            <exclude>tests/phpunit/tests/actions/closures.php</exclude>
     
    1616            <exclude>tests/phpunit/tests/image/editorGd.php</exclude>
    1717            <exclude>tests/phpunit/tests/image/editorImagick.php</exclude>
     18            <!-- DOING_AUTOSAVE constant pollutes test suite -->
     19            <!-- and there is a weird 5.2 edge case: https://core.trac.wordpress.org/ticket/45132 -->
     20            <exclude>tests/rest-api/rest-autosaves-controller.php</exclude>
     21            <exclude>tests/phpunit/tests/rest-api/rest-autosaves-controller.php</exclude>
    1822            <file phpVersion="5.3.0">tests/phpunit/tests/actions/closures.php</file>
    1923            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor.php</file>
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r44107 r44126  
    9090            '/wp/v2/posts/(?P<parent>[\\d]+)/revisions',
    9191            '/wp/v2/posts/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)',
     92            '/wp/v2/posts/(?P<parent>[\\d]+)/autosaves',
     93            '/wp/v2/posts/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)',
    9294            '/wp/v2/pages',
    9395            '/wp/v2/pages/(?P<id>[\\d]+)',
    9496            '/wp/v2/pages/(?P<parent>[\\d]+)/revisions',
    9597            '/wp/v2/pages/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)',
     98            '/wp/v2/pages/(?P<parent>[\\d]+)/autosaves',
     99            '/wp/v2/pages/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)',
    96100            '/wp/v2/media',
    97101            '/wp/v2/media/(?P<id>[\\d]+)',
     
    162166        $post_revision_id = $post_revisions[ count( $post_revisions ) - 1 ]->ID;
    163167
     168        // Create an autosave.
     169        wp_create_post_autosave(
     170            array(
     171                'post_ID'      => $post_id,
     172                'post_content' => 'Autosave post content.',
     173                'post_type'    => 'post',
     174            )
     175        );
     176
    164177        $page_id = $this->factory->post->create(
    165178            array(
     
    182195        $page_revisions   = array_values( wp_get_post_revisions( $page_id ) );
    183196        $page_revision_id = $page_revisions[ count( $page_revisions ) - 1 ]->ID;
     197
     198        // Create an autosave.
     199        wp_create_post_autosave(
     200            array(
     201                'post_ID'      => $page_id,
     202                'post_content' => 'Autosave page content.',
     203                'post_type'    => 'page',
     204            )
     205        );
    184206
    185207        $tag_id = $this->factory->tag->create(
     
    277299            ),
    278300            array(
     301                'route' => '/wp/v2/posts/' . $post_id . '/autosaves',
     302                'name'  => 'postAutosaves',
     303            ),
     304            array(
     305                'route' => '/wp/v2/posts/' . $post_id . '/autosaves/' . $post_revision_id,
     306                'name'  => 'autosave',
     307            ),
     308            array(
    279309                'route' => '/wp/v2/pages',
    280310                'name'  => 'PagesCollection',
     
    291321                'route' => '/wp/v2/pages/' . $page_id . '/revisions/' . $page_revision_id,
    292322                'name'  => 'pageRevision',
     323            ),
     324            array(
     325                'route' => '/wp/v2/pages/' . $page_id . '/autosaves',
     326                'name'  => 'pageAutosaves',
     327            ),
     328            array(
     329                'route' => '/wp/v2/pages/' . $page_id . '/autosaves/' . $page_revision_id,
     330                'name'  => 'pageAutosave',
    293331            ),
    294332            array(
  • trunk/tests/phpunit/tests/rest-api/rest-users-controller.php

    r43571 r44126  
    897897    public function test_get_user_invalid_id() {
    898898        wp_set_current_user( self::$user );
    899         $request  = new WP_REST_Request( 'GET', '/wp/v2/users/7777' );
     899
     900        $request  = new WP_REST_Request( 'GET', '/wp/v2/users/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER );
    900901        $response = rest_get_server()->dispatch( $request );
    901902
     
    22662267        wp_set_current_user( self::$user );
    22672268
    2268         $request          = new WP_REST_Request( 'DELETE', '/wp/v2/users/7777' );
     2269        $request          = new WP_REST_Request( 'DELETE', '/wp/v2/users/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER );
    22692270        $request['force'] = true;
    22702271        $request->set_param( 'reassign', false );
     
    23182319        $request          = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d', $user_id ) );
    23192320        $request['force'] = true;
    2320         $request->set_param( 'reassign', 7777 );
     2321        $request->set_param( 'reassign', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER );
    23212322        $response = rest_get_server()->dispatch( $request );
    23222323
  • trunk/tests/qunit/fixtures/wp-api-generated.js

    r44107 r44126  
    851851            ]
    852852        },
     853        "/wp/v2/posts/(?P<parent>[\\d]+)/autosaves": {
     854            "namespace": "wp/v2",
     855            "methods": [
     856                "GET",
     857                "POST"
     858            ],
     859            "endpoints": [
     860                {
     861                    "methods": [
     862                        "GET"
     863                    ],
     864                    "args": {
     865                        "parent": {
     866                            "required": false,
     867                            "description": "The ID for the parent of the object.",
     868                            "type": "integer"
     869                        },
     870                        "context": {
     871                            "required": false,
     872                            "default": "view",
     873                            "enum": [
     874                                "view",
     875                                "embed",
     876                                "edit"
     877                            ],
     878                            "description": "Scope under which the request is made; determines fields present in response.",
     879                            "type": "string"
     880                        },
     881                        "page": {
     882                            "required": false,
     883                            "default": 1,
     884                            "description": "Current page of the collection.",
     885                            "type": "integer"
     886                        },
     887                        "per_page": {
     888                            "required": false,
     889                            "description": "Maximum number of items to be returned in result set.",
     890                            "type": "integer"
     891                        },
     892                        "search": {
     893                            "required": false,
     894                            "description": "Limit results to those matching a string.",
     895                            "type": "string"
     896                        },
     897                        "exclude": {
     898                            "required": false,
     899                            "default": [],
     900                            "description": "Ensure result set excludes specific IDs.",
     901                            "type": "array",
     902                            "items": {
     903                                "type": "integer"
     904                            }
     905                        },
     906                        "include": {
     907                            "required": false,
     908                            "default": [],
     909                            "description": "Limit result set to specific IDs.",
     910                            "type": "array",
     911                            "items": {
     912                                "type": "integer"
     913                            }
     914                        },
     915                        "offset": {
     916                            "required": false,
     917                            "description": "Offset the result set by a specific number of items.",
     918                            "type": "integer"
     919                        },
     920                        "order": {
     921                            "required": false,
     922                            "default": "desc",
     923                            "enum": [
     924                                "asc",
     925                                "desc"
     926                            ],
     927                            "description": "Order sort attribute ascending or descending.",
     928                            "type": "string"
     929                        },
     930                        "orderby": {
     931                            "required": false,
     932                            "default": "date",
     933                            "enum": [
     934                                "date",
     935                                "id",
     936                                "include",
     937                                "relevance",
     938                                "slug",
     939                                "include_slugs",
     940                                "title"
     941                            ],
     942                            "description": "Sort collection by object attribute.",
     943                            "type": "string"
     944                        }
     945                    }
     946                },
     947                {
     948                    "methods": [
     949                        "POST"
     950                    ],
     951                    "args": {
     952                        "parent": {
     953                            "required": false,
     954                            "description": "The ID for the parent of the object.",
     955                            "type": "integer"
     956                        },
     957                        "author": {
     958                            "required": false,
     959                            "description": "The ID for the author of the object.",
     960                            "type": "integer"
     961                        },
     962                        "date": {
     963                            "required": false,
     964                            "description": "The date the object was published, in the site's timezone.",
     965                            "type": "string"
     966                        },
     967                        "date_gmt": {
     968                            "required": false,
     969                            "description": "The date the object was published, as GMT.",
     970                            "type": "string"
     971                        },
     972                        "id": {
     973                            "required": false,
     974                            "description": "Unique identifier for the object.",
     975                            "type": "integer"
     976                        },
     977                        "modified": {
     978                            "required": false,
     979                            "description": "The date the object was last modified, in the site's timezone.",
     980                            "type": "string"
     981                        },
     982                        "modified_gmt": {
     983                            "required": false,
     984                            "description": "The date the object was last modified, as GMT.",
     985                            "type": "string"
     986                        },
     987                        "slug": {
     988                            "required": false,
     989                            "description": "An alphanumeric identifier for the object unique to its type.",
     990                            "type": "string"
     991                        },
     992                        "title": {
     993                            "required": false,
     994                            "description": "The title for the object.",
     995                            "type": "object"
     996                        },
     997                        "content": {
     998                            "required": false,
     999                            "description": "The content for the object.",
     1000                            "type": "object"
     1001                        },
     1002                        "excerpt": {
     1003                            "required": false,
     1004                            "description": "The excerpt for the object.",
     1005                            "type": "object"
     1006                        }
     1007                    }
     1008                }
     1009            ]
     1010        },
     1011        "/wp/v2/posts/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)": {
     1012            "namespace": "wp/v2",
     1013            "methods": [
     1014                "GET"
     1015            ],
     1016            "endpoints": [
     1017                {
     1018                    "methods": [
     1019                        "GET"
     1020                    ],
     1021                    "args": {
     1022                        "parent": {
     1023                            "required": false,
     1024                            "description": "The ID for the parent of the object.",
     1025                            "type": "integer"
     1026                        },
     1027                        "id": {
     1028                            "required": false,
     1029                            "description": "The ID for the object.",
     1030                            "type": "integer"
     1031                        },
     1032                        "context": {
     1033                            "required": false,
     1034                            "default": "view",
     1035                            "enum": [
     1036                                "view",
     1037                                "embed",
     1038                                "edit"
     1039                            ],
     1040                            "description": "Scope under which the request is made; determines fields present in response.",
     1041                            "type": "string"
     1042                        }
     1043                    }
     1044                }
     1045            ]
     1046        },
    8531047        "/wp/v2/pages": {
    8541048            "namespace": "wp/v2",
     
    14521646                            "description": "Required to be true, as revisions do not support trashing.",
    14531647                            "type": "boolean"
     1648                        }
     1649                    }
     1650                }
     1651            ]
     1652        },
     1653        "/wp/v2/pages/(?P<parent>[\\d]+)/autosaves": {
     1654            "namespace": "wp/v2",
     1655            "methods": [
     1656                "GET",
     1657                "POST"
     1658            ],
     1659            "endpoints": [
     1660                {
     1661                    "methods": [
     1662                        "GET"
     1663                    ],
     1664                    "args": {
     1665                        "parent": {
     1666                            "required": false,
     1667                            "description": "The ID for the parent of the object.",
     1668                            "type": "integer"
     1669                        },
     1670                        "context": {
     1671                            "required": false,
     1672                            "default": "view",
     1673                            "enum": [
     1674                                "view",
     1675                                "embed",
     1676                                "edit"
     1677                            ],
     1678                            "description": "Scope under which the request is made; determines fields present in response.",
     1679                            "type": "string"
     1680                        },
     1681                        "page": {
     1682                            "required": false,
     1683                            "default": 1,
     1684                            "description": "Current page of the collection.",
     1685                            "type": "integer"
     1686                        },
     1687                        "per_page": {
     1688                            "required": false,
     1689                            "description": "Maximum number of items to be returned in result set.",
     1690                            "type": "integer"
     1691                        },
     1692                        "search": {
     1693                            "required": false,
     1694                            "description": "Limit results to those matching a string.",
     1695                            "type": "string"
     1696                        },
     1697                        "exclude": {
     1698                            "required": false,
     1699                            "default": [],
     1700                            "description": "Ensure result set excludes specific IDs.",
     1701                            "type": "array",
     1702                            "items": {
     1703                                "type": "integer"
     1704                            }
     1705                        },
     1706                        "include": {
     1707                            "required": false,
     1708                            "default": [],
     1709                            "description": "Limit result set to specific IDs.",
     1710                            "type": "array",
     1711                            "items": {
     1712                                "type": "integer"
     1713                            }
     1714                        },
     1715                        "offset": {
     1716                            "required": false,
     1717                            "description": "Offset the result set by a specific number of items.",
     1718                            "type": "integer"
     1719                        },
     1720                        "order": {
     1721                            "required": false,
     1722                            "default": "desc",
     1723                            "enum": [
     1724                                "asc",
     1725                                "desc"
     1726                            ],
     1727                            "description": "Order sort attribute ascending or descending.",
     1728                            "type": "string"
     1729                        },
     1730                        "orderby": {
     1731                            "required": false,
     1732                            "default": "date",
     1733                            "enum": [
     1734                                "date",
     1735                                "id",
     1736                                "include",
     1737                                "relevance",
     1738                                "slug",
     1739                                "include_slugs",
     1740                                "title"
     1741                            ],
     1742                            "description": "Sort collection by object attribute.",
     1743                            "type": "string"
     1744                        }
     1745                    }
     1746                },
     1747                {
     1748                    "methods": [
     1749                        "POST"
     1750                    ],
     1751                    "args": {
     1752                        "parent": {
     1753                            "required": false,
     1754                            "description": "The ID for the parent of the object.",
     1755                            "type": "integer"
     1756                        },
     1757                        "author": {
     1758                            "required": false,
     1759                            "description": "The ID for the author of the object.",
     1760                            "type": "integer"
     1761                        },
     1762                        "date": {
     1763                            "required": false,
     1764                            "description": "The date the object was published, in the site's timezone.",
     1765                            "type": "string"
     1766                        },
     1767                        "date_gmt": {
     1768                            "required": false,
     1769                            "description": "The date the object was published, as GMT.",
     1770                            "type": "string"
     1771                        },
     1772                        "id": {
     1773                            "required": false,
     1774                            "description": "Unique identifier for the object.",
     1775                            "type": "integer"
     1776                        },
     1777                        "modified": {
     1778                            "required": false,
     1779                            "description": "The date the object was last modified, in the site's timezone.",
     1780                            "type": "string"
     1781                        },
     1782                        "modified_gmt": {
     1783                            "required": false,
     1784                            "description": "The date the object was last modified, as GMT.",
     1785                            "type": "string"
     1786                        },
     1787                        "slug": {
     1788                            "required": false,
     1789                            "description": "An alphanumeric identifier for the object unique to its type.",
     1790                            "type": "string"
     1791                        },
     1792                        "title": {
     1793                            "required": false,
     1794                            "description": "The title for the object.",
     1795                            "type": "object"
     1796                        },
     1797                        "content": {
     1798                            "required": false,
     1799                            "description": "The content for the object.",
     1800                            "type": "object"
     1801                        },
     1802                        "excerpt": {
     1803                            "required": false,
     1804                            "description": "The excerpt for the object.",
     1805                            "type": "object"
     1806                        }
     1807                    }
     1808                }
     1809            ]
     1810        },
     1811        "/wp/v2/pages/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)": {
     1812            "namespace": "wp/v2",
     1813            "methods": [
     1814                "GET"
     1815            ],
     1816            "endpoints": [
     1817                {
     1818                    "methods": [
     1819                        "GET"
     1820                    ],
     1821                    "args": {
     1822                        "parent": {
     1823                            "required": false,
     1824                            "description": "The ID for the parent of the object.",
     1825                            "type": "integer"
     1826                        },
     1827                        "id": {
     1828                            "required": false,
     1829                            "description": "The ID for the object.",
     1830                            "type": "integer"
     1831                        },
     1832                        "context": {
     1833                            "required": false,
     1834                            "default": "view",
     1835                            "enum": [
     1836                                "view",
     1837                                "embed",
     1838                                "edit"
     1839                            ],
     1840                            "description": "Scope under which the request is made; determines fields present in response.",
     1841                            "type": "string"
    14541842                        }
    14551843                    }
     
    38514239            "version-history": [
    38524240                {
    3853                     "count": 1,
     4241                    "count": 2,
    38544242                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions"
    38554243                }
     
    39434331        },
    39444332        "title": {
     4333            "rendered": ""
     4334        },
     4335        "content": {
     4336            "rendered": "<p>Autosave post content.</p>\n"
     4337        },
     4338        "excerpt": {
     4339            "rendered": ""
     4340        },
     4341        "_links": {
     4342            "parent": [
     4343                {
     4344                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4"
     4345                }
     4346            ]
     4347        }
     4348    },
     4349    {
     4350        "author": 359,
     4351        "date": "2017-02-14T00:00:00",
     4352        "date_gmt": "2017-02-14T00:00:00",
     4353        "id": 36734,
     4354        "modified": "2017-02-14T00:00:00",
     4355        "modified_gmt": "2017-02-14T00:00:00",
     4356        "parent": 36733,
     4357        "slug": "36733-revision-v1",
     4358        "guid": {
     4359            "rendered": "http://example.org/?p=36734"
     4360        },
     4361        "title": {
    39454362            "rendered": "REST API Client Fixture: Post"
    39464363        },
     
    39544371            "parent": [
    39554372                {
    3956                     "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4"
     4373                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/36733"
    39574374                }
    39584375            ]
     
    39844401};
    39854402
     4403mockedApiResponse.postAutosaves = [
     4404    {
     4405        "author": 359,
     4406        "date": "2017-02-14T00:00:00",
     4407        "date_gmt": "2017-02-14T00:00:00",
     4408        "id": 36735,
     4409        "modified": "2017-02-14T00:00:00",
     4410        "modified_gmt": "2017-02-14T00:00:00",
     4411        "parent": 36733,
     4412        "slug": "36733-autosave-v1",
     4413        "guid": {
     4414            "rendered": "http://example.org/?p=36735"
     4415        },
     4416        "title": {
     4417            "rendered": ""
     4418        },
     4419        "content": {
     4420            "rendered": "<p>Autosave post content.</p>\n"
     4421        },
     4422        "excerpt": {
     4423            "rendered": ""
     4424        },
     4425        "_links": {
     4426            "parent": [
     4427                {
     4428                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/36733"
     4429                }
     4430            ]
     4431        }
     4432    }
     4433];
     4434
     4435mockedApiResponse.autosave = {
     4436    "author": 359,
     4437    "date": "2017-02-14T00:00:00",
     4438    "date_gmt": "2017-02-14T00:00:00",
     4439    "id": 36735,
     4440    "modified": "2017-02-14T00:00:00",
     4441    "modified_gmt": "2017-02-14T00:00:00",
     4442    "parent": 36733,
     4443    "slug": "36733-autosave-v1",
     4444    "guid": {
     4445        "rendered": "http://example.org/?p=36735"
     4446    },
     4447    "title": {
     4448        "rendered": ""
     4449    },
     4450    "content": {
     4451        "rendered": "<p>Autosave post content.</p>\n"
     4452    },
     4453    "excerpt": {
     4454        "rendered": ""
     4455    }
     4456};
     4457
    39864458mockedApiResponse.PagesCollection = [
    39874459    {
     
    40434515            "version-history": [
    40444516                {
    4045                     "count": 1,
     4517                    "count": 2,
    40464518                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions"
    40474519                }
     
    41194591        },
    41204592        "title": {
     4593            "rendered": ""
     4594        },
     4595        "content": {
     4596            "rendered": "<p>Autosave page content.</p>\n"
     4597        },
     4598        "excerpt": {
     4599            "rendered": ""
     4600        },
     4601        "_links": {
     4602            "parent": [
     4603                {
     4604                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6"
     4605                }
     4606            ]
     4607        }
     4608    },
     4609    {
     4610        "author": 359,
     4611        "date": "2017-02-14T00:00:00",
     4612        "date_gmt": "2017-02-14T00:00:00",
     4613        "id": 36737,
     4614        "modified": "2017-02-14T00:00:00",
     4615        "modified_gmt": "2017-02-14T00:00:00",
     4616        "parent": 36736,
     4617        "slug": "36736-revision-v1",
     4618        "guid": {
     4619            "rendered": "http://example.org/?p=36737"
     4620        },
     4621        "title": {
    41214622            "rendered": "REST API Client Fixture: Page"
    41224623        },
     
    41304631            "parent": [
    41314632                {
    4132                     "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6"
     4633                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/36736"
    41334634                }
    41344635            ]
     
    41574658    "excerpt": {
    41584659        "rendered": "<p>REST API Client Fixture: Page</p>\n"
     4660    }
     4661};
     4662
     4663mockedApiResponse.pageAutosaves = [
     4664    {
     4665        "author": 359,
     4666        "date": "2017-02-14T00:00:00",
     4667        "date_gmt": "2017-02-14T00:00:00",
     4668        "id": 36738,
     4669        "modified": "2017-02-14T00:00:00",
     4670        "modified_gmt": "2017-02-14T00:00:00",
     4671        "parent": 36736,
     4672        "slug": "36736-autosave-v1",
     4673        "guid": {
     4674            "rendered": "http://example.org/?p=36738"
     4675        },
     4676        "title": {
     4677            "rendered": ""
     4678        },
     4679        "content": {
     4680            "rendered": "<p>Autosave page content.</p>\n"
     4681        },
     4682        "excerpt": {
     4683            "rendered": ""
     4684        },
     4685        "_links": {
     4686            "parent": [
     4687                {
     4688                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/36736"
     4689                }
     4690            ]
     4691        }
     4692    }
     4693];
     4694
     4695mockedApiResponse.pageAutosave = {
     4696    "author": 359,
     4697    "date": "2017-02-14T00:00:00",
     4698    "date_gmt": "2017-02-14T00:00:00",
     4699    "id": 36738,
     4700    "modified": "2017-02-14T00:00:00",
     4701    "modified_gmt": "2017-02-14T00:00:00",
     4702    "parent": 36736,
     4703    "slug": "36736-autosave-v1",
     4704    "guid": {
     4705        "rendered": "http://example.org/?p=36738"
     4706    },
     4707    "title": {
     4708        "rendered": ""
     4709    },
     4710    "content": {
     4711        "rendered": "<p>Autosave page content.</p>\n"
     4712    },
     4713    "excerpt": {
     4714        "rendered": ""
    41594715    }
    41604716};
Note: See TracChangeset for help on using the changeset viewer.