- Timestamp:
- 02/27/2017 08:02:43 PM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
- Property svn:mergeinfo changed
/trunk merged: 40120-40121
- Property svn:mergeinfo changed
-
branches/4.7/tests/phpunit/tests/rest-api/rest-posts-controller.php
r40136 r40137 991 991 } 992 992 993 public function test_get_items_no_supported_post_formats() { 994 // This causes get_theme_support( 'post-formats' ) to return `true` (not an array) 995 add_theme_support( 'post-formats' ); 996 993 public function test_get_items_all_post_formats() { 997 994 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/posts' ); 998 995 $response = $this->server->dispatch( $request ); 999 996 $data = $response->get_data(); 1000 997 1001 // Set the expected state back for the rest of the tests. 1002 global $_wp_theme_features; 1003 unset( $_wp_theme_features['post-formats'] ); 1004 add_theme_support( 'post-formats', array( 'post', 'gallery' ) ); 1005 1006 $formats = array( 'standard' ); 998 $formats = array_values( get_post_format_slugs() ); 1007 999 1008 1000 $this->assertEquals( $formats, $data['schema']['properties']['format']['enum'] ); … … 1652 1644 $request->set_body_params( $params ); 1653 1645 $response = $this->server->dispatch( $request ); 1654 1655 $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); 1646 $this->assertEquals( 201, $response->get_status() ); 1647 1648 $data = $response->get_data(); 1649 $this->assertEquals( 'link', $data['format'] ); 1656 1650 } 1657 1651 … … 2150 2144 $request->set_body_params( $params ); 2151 2145 $response = $this->server->dispatch( $request ); 2152 2153 $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); 2146 $this->assertEquals( 200, $response->get_status() ); 2147 2148 $data = $response->get_data(); 2149 $this->assertEquals( 'link', $data['format'] ); 2154 2150 } 2155 2151
Note: See TracChangeset
for help on using the changeset viewer.