- Timestamp:
- 07/13/2018 06:13:27 AM (6 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
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
Note: See TracChangeset
for help on using the changeset viewer.