Changeset 60357
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
r60301 r60357 146 146 $options = $this->get_registered_options(); 147 147 148 $params = $request->get_params();148 $params = array_diff_key( $request->get_params(), $request->get_query_params() ); 149 149 150 150 if ( empty( $params ) || ! empty( array_diff_key( $params, $options ) ) ) { -
trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php
r60301 r60357 398 398 } 399 399 400 /** 401 * @ticket 41604 402 */ 400 403 public function test_update_item() { 401 404 wp_set_current_user( self::$administrator ); … … 411 414 } 412 415 416 /** 417 * @ticket 41604 418 */ 419 public function test_update_item_with_global_parameters_present() { 420 wp_set_current_user( self::$administrator ); 421 422 $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' ); 423 $request->set_param( 'title', 'The new title!' ); 424 $request->set_url_params( array( '_locale' => 'user' ) ); 425 $response = rest_get_server()->dispatch( $request ); 426 $data = $response->get_data(); 427 428 $this->assertSame( 200, $response->get_status() ); 429 $this->assertSame( 'The new title!', $data['title'] ); 430 $this->assertSame( get_option( 'blogname' ), $data['title'] ); 431 } 432 433 /** 434 * @ticket 41604 435 */ 436 public function test_update_item_with_empty_body() { 437 wp_set_current_user( self::$administrator ); 438 439 $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' ); 440 $response = rest_get_server()->dispatch( $request ); 441 $data = $response->get_data(); 442 443 $this->assertSame( 400, $response->get_status() ); 444 } 445 446 /** 447 * @ticket 41604 448 */ 413 449 public function test_update_nonexistent_item() { 414 450 wp_set_current_user( self::$administrator ); … … 421 457 } 422 458 459 /** 460 * @ticket 41604 461 */ 423 462 public function test_update_partially_valid_items() { 424 463 wp_set_current_user( self::$administrator );
Note: See TracChangeset
for help on using the changeset viewer.