- Timestamp:
- 07/13/2018 04:23:35 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r43087 r43440 13 13 class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcase { 14 14 protected static $administrator; 15 protected static $contributor; 15 16 protected static $subscriber; 16 17 … … 19 20 array( 20 21 'role' => 'administrator', 22 ) 23 ); 24 self::$contributor = $factory->user->create( 25 array( 26 'role' => 'subscriber', 21 27 ) 22 28 ); … … 721 727 public function test_create_item_incorrect_permissions() { 722 728 wp_set_current_user( self::$subscriber ); 729 $request = new WP_REST_Request( 'POST', '/wp/v2/categories' ); 730 $request->set_param( 'name', 'Incorrect permissions' ); 731 $response = rest_get_server()->dispatch( $request ); 732 $this->assertErrorResponse( 'rest_cannot_create', $response, 403 ); 733 } 734 735 public function test_create_item_incorrect_permissions_contributor() { 736 wp_set_current_user( self::$contributor ); 723 737 $request = new WP_REST_Request( 'POST', '/wp/v2/categories' ); 724 738 $request->set_param( 'name', 'Incorrect permissions' );
Note: See TracChangeset
for help on using the changeset viewer.