- Timestamp:
- 02/24/2017 11:29:04 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r40108 r40120 915 915 } 916 916 917 public function test_get_items_no_supported_post_formats() { 918 // This causes get_theme_support( 'post-formats' ) to return `true` (not an array) 919 add_theme_support( 'post-formats' ); 920 917 public function test_get_items_all_post_formats() { 921 918 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/posts' ); 922 919 $response = $this->server->dispatch( $request ); 923 920 $data = $response->get_data(); 924 921 925 // Set the expected state back for the rest of the tests. 926 global $_wp_theme_features; 927 unset( $_wp_theme_features['post-formats'] ); 928 add_theme_support( 'post-formats', array( 'post', 'gallery' ) ); 929 930 $formats = array( 'standard' ); 922 $formats = array_values( get_post_format_slugs() ); 931 923 932 924 $this->assertEquals( $formats, $data['schema']['properties']['format']['enum'] ); … … 1576 1568 $request->set_body_params( $params ); 1577 1569 $response = $this->server->dispatch( $request ); 1578 1579 $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); 1570 $this->assertEquals( 201, $response->get_status() ); 1571 1572 $data = $response->get_data(); 1573 $this->assertEquals( 'link', $data['format'] ); 1580 1574 } 1581 1575 … … 2074 2068 $request->set_body_params( $params ); 2075 2069 $response = $this->server->dispatch( $request ); 2076 2077 $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); 2070 $this->assertEquals( 200, $response->get_status() ); 2071 2072 $data = $response->get_data(); 2073 $this->assertEquals( 'link', $data['format'] ); 2078 2074 } 2079 2075
Note: See TracChangeset
for help on using the changeset viewer.