- Timestamp:
- 03/19/2019 03:21:28 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r44785 r44933 207 207 sort( $keys ); 208 208 $this->assertEquals( array( 'context', 'id' ), $keys ); 209 } 210 211 /** 212 * @ticket 43701 213 */ 214 public function test_allow_header_sent_on_options_request() { 215 $id1 = $this->factory->attachment->create_object( 216 $this->test_file, 217 0, 218 array( 219 'post_mime_type' => 'image/jpeg', 220 'post_excerpt' => 'A sample caption', 221 ) 222 ); 223 $request = new WP_REST_Request( 'OPTIONS', sprintf( '/wp/v2/media/%d', $id1 ) ); 224 $response = rest_get_server()->dispatch( $request ); 225 $response = apply_filters( 'rest_post_dispatch', $response, rest_get_server(), $request ); 226 $headers = $response->get_headers(); 227 228 $this->assertNotEmpty( $headers['Allow'] ); 229 $this->assertEquals( $headers['Allow'], 'GET' ); 230 231 wp_set_current_user( self::$editor_id ); 232 $request = new WP_REST_Request( 'OPTIONS', sprintf( '/wp/v2/media/%d', $id1 ) ); 233 $response = rest_get_server()->dispatch( $request ); 234 $response = apply_filters( 'rest_post_dispatch', $response, rest_get_server(), $request ); 235 $headers = $response->get_headers(); 236 237 $this->assertNotEmpty( $headers['Allow'] ); 238 $this->assertEquals( $headers['Allow'], 'GET, POST, PUT, PATCH, DELETE' ); 209 239 } 210 240
Note: See TracChangeset
for help on using the changeset viewer.