- Timestamp:
- 01/01/2018 02:30:39 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php
r42359 r42423 11 11 */ 12 12 class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase { 13 13 14 protected static $administrator; 15 protected static $author; 14 16 15 17 public static function wpSetUpBeforeClass( $factory ) { … … 19 21 ) 20 22 ); 23 24 self::$author = $factory->user->create( 25 array( 26 'role' => 'author', 27 ) 28 ); 21 29 } 22 30 23 31 public static function wpTearDownAfterClass() { 24 32 self::delete_user( self::$administrator ); 33 self::delete_user( self::$author ); 25 34 } 26 35 … … 46 55 } 47 56 48 public function test_get_item_is_not_public() { 57 public function test_get_item_is_not_public_not_authenticated() { 58 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); 59 $response = $this->server->dispatch( $request ); 60 $this->assertEquals( 401, $response->get_status() ); 61 } 62 63 public function test_get_item_is_not_public_no_permission() { 64 wp_set_current_user( self::$author ); 49 65 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); 50 66 $response = $this->server->dispatch( $request );
Note: See TracChangeset
for help on using the changeset viewer.