- Timestamp:
- 07/13/2018 04:06:23 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r43437 r43439 1284 1284 1285 1285 $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions' ), $links['version-history'][0]['href'] ); 1286 $this->assertEquals( 0, $links['version-history'][0]['attributes']['count'] ); 1287 $this->assertFalse( isset( $links['predecessor-version'] ) ); 1286 1288 1287 1289 $attachments_url = rest_url( '/wp/v2/media' ); … … 1309 1311 $category_url = add_query_arg( 'post', self::$post_id, rest_url( '/wp/v2/categories' ) ); 1310 1312 $this->assertEquals( $category_url, $cat_link['href'] ); 1313 } 1314 1315 public function test_get_item_links_predecessor() { 1316 wp_update_post( 1317 array( 1318 'post_content' => 'This content is marvelous.', 1319 'ID' => self::$post_id, 1320 ) 1321 ); 1322 $revisions = wp_get_post_revisions( self::$post_id ); 1323 $revision_1 = array_pop( $revisions ); 1324 1325 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); 1326 $response = rest_get_server()->dispatch( $request ); 1327 1328 $links = $response->get_links(); 1329 1330 $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions' ), $links['version-history'][0]['href'] ); 1331 $this->assertEquals( 1, $links['version-history'][0]['attributes']['count'] ); 1332 1333 $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions/' . $revision_1->ID ), $links['predecessor-version'][0]['href'] ); 1334 $this->assertEquals( $revision_1->ID, $links['predecessor-version'][0]['attributes']['id'] ); 1311 1335 } 1312 1336
Note: See TracChangeset
for help on using the changeset viewer.