- 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-taxonomies-controller.php
r42343 r42423 11 11 */ 12 12 class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcase { 13 14 protected static $contributor_id; 15 16 public static function wpSetUpBeforeClass( $factory ) { 17 self::$contributor_id = $factory->user->create( 18 array( 19 'role' => 'contributor', 20 ) 21 ); 22 } 23 24 public static function wpTearDownAfterClass() { 25 self::delete_user( self::$contributor_id ); 26 } 13 27 14 28 public function test_register_routes() { … … 102 116 } 103 117 104 public function test_get_non_public_taxonomy() { 118 public function test_get_non_public_taxonomy_not_authenticated() { 119 register_taxonomy( 'api-private', 'post', array( 'public' => false ) ); 120 121 $request = new WP_REST_Request( 'GET', '/wp/v2/taxonomies/api-private' ); 122 $response = $this->server->dispatch( $request ); 123 $this->assertErrorResponse( 'rest_forbidden', $response, 401 ); 124 } 125 126 public function test_get_non_public_taxonomy_no_permission() { 127 wp_set_current_user( self::$contributor_id ); 105 128 register_taxonomy( 'api-private', 'post', array( 'public' => false ) ); 106 129
Note: See TracChangeset
for help on using the changeset viewer.