WordPress.org

Make WordPress Core

Ticket #50986: 50986.diff

File 50986.diff, 1.4 KB (added by david.binda, 17 months ago)
  • tests/phpunit/tests/rest-api/rest-settings-controller.php

     
    313313                $this->assertEquals( 'unfiltered2', $data['mycustomsettinginrest2'] );
    314314
    315315                unregister_setting( 'somegroup', 'mycustomsetting' );
     316                unregister_setting( 'somegroup', 'mycustomsetting1' );
     317                unregister_setting( 'somegroup', 'mycustomsetting2' );
    316318                remove_all_filters( 'rest_pre_get_setting' );
    317319        }
    318320
     
    340342                $response = rest_get_server()->dispatch( $request );
    341343                $data     = $response->get_data();
    342344                $this->assertEquals( null, $data['mycustomsettinginrest'] );
     345
     346                unregister_setting( 'somegroup', 'mycustomsetting' );
    343347        }
    344348
    345349        public function test_get_item_with_invalid_object_array_in_options() {
     
    481485                );
    482486                $response = rest_get_server()->dispatch( $request );
    483487                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
     488
     489                unregister_setting( 'somegroup', 'mycustomsetting' );
    484490        }
    485491
    486492        public function test_update_item_with_object() {
     
    643649                $response = rest_get_server()->dispatch( $request );
    644650
    645651                $this->assertErrorResponse( 'rest_invalid_stored_value', $response, 500 );
     652
     653                unregister_setting( 'somegroup', 'mycustomsetting' );
    646654        }
    647655
    648656        public function test_delete_item() {