WordPress.org

Make WordPress Core

Ticket #41604: 41604.test.patch

File 41604.test.patch, 787 bytes (added by johnbillion, 3 years ago)
  • tests/phpunit/tests/rest-api/rest-settings-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-settings-controller.php tests/phpunit/tests/rest-api/rest-settings-controller.php
    index 853a013d5c..8618d8888f 100644
    class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase 
    219219
    220220
    221221        public function test_create_item() {
     222                wp_set_current_user( self::$administrator );
     223                /** Settings can't be created **/
     224                $request = new WP_REST_Request( 'POST', '/wp/v2/settings' );
     225                $request->set_param( 'new_setting', 'New value' );
     226                $response = $this->server->dispatch( $request );
     227                $this->assertEquals( 400, $response->get_status() );
    222228        }
    223229
    224230        public function test_update_item() {