Make WordPress Core


Ignore:
Timestamp:
08/04/2017 01:55:04 PM (7 years ago)
Author:
johnbillion
Message:

REST API: Populate some missing tests from test cases which extend the controller test case.

See #41463

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php

    r39471 r41228  
    3333    }
    3434
     35    public function test_get_item() {
     36        /** Individual settings can't be gotten **/
     37        wp_set_current_user( self::$administrator );
     38        $request = new WP_REST_Request( 'GET', '/wp/v2/settings/title' );
     39        $response = $this->server->dispatch( $request );
     40        $this->assertEquals( 404, $response->get_status() );
     41    }
     42
     43    public function test_context_param() {
     44    }
     45
     46    public function test_get_item_is_not_public() {
     47        $request = new WP_REST_Request( 'GET', '/wp/v2/settings' );
     48        $response = $this->server->dispatch( $request );
     49        $this->assertEquals( 403, $response->get_status() );
     50    }
     51
    3552    public function test_get_items() {
    36     }
    37 
    38     public function test_context_param() {
    39     }
    40 
    41     public function test_get_item_is_not_public() {
    42         $request = new WP_REST_Request( 'GET', '/wp/v2/settings' );
    43         $response = $this->server->dispatch( $request );
    44         $this->assertEquals( 403, $response->get_status() );
    45     }
    46 
    47     public function test_get_item() {
    4853        wp_set_current_user( self::$administrator );
    4954        $request = new WP_REST_Request( 'GET', '/wp/v2/settings' );
     
    337342
    338343    public function test_delete_item() {
     344        /** Settings can't be deleted **/
     345        $request = new WP_REST_Request( 'DELETE', '/wp/v2/settings/title' );
     346        $response = $this->server->dispatch( $request );
     347        $this->assertEquals( 404, $response->get_status() );
    339348    }
    340349
Note: See TracChangeset for help on using the changeset viewer.