- Timestamp:
- 01/06/2018 07:28:44 PM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/tests/phpunit/tests/rest-api/rest-settings-controller.php
r42000 r42427 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 ) { … … 17 19 'role' => 'administrator', 18 20 ) ); 21 22 self::$author = $factory->user->create( 23 array( 24 'role' => 'author', 25 ) 26 ); 19 27 } 20 28 21 29 public static function wpTearDownAfterClass() { 22 30 self::delete_user( self::$administrator ); 31 self::delete_user( self::$author ); 23 32 } 24 33 … … 44 53 } 45 54 46 public function test_get_item_is_not_public() { 47 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); 55 public function test_get_item_is_not_public_not_authenticated() { 56 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); 57 $response = $this->server->dispatch( $request ); 58 $this->assertEquals( 401, $response->get_status() ); 59 } 60 61 public function test_get_item_is_not_public_no_permission() { 62 wp_set_current_user( self::$author ); 63 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); 48 64 $response = $this->server->dispatch( $request ); 49 65 $this->assertEquals( 403, $response->get_status() );
Note: See TracChangeset
for help on using the changeset viewer.