Changeset 55177
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r54817 r55177 432 432 * 433 433 * @since 5.9.0 434 * @since 6.2.0 Added 'edit-css' action. 434 435 * 435 436 * @return array List of link relations. … … 441 442 if ( current_user_can( $post_type->cap->publish_posts ) ) { 442 443 $rels[] = 'https://api.w.org/action-publish'; 444 } 445 446 if ( current_user_can( 'edit_css' ) ) { 447 $rels[] = 'https://api.w.org/action-edit-css'; 443 448 } 444 449 -
trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php
r54402 r55177 514 514 $this->assertSameSetsWithIndex( $data, $expected ); 515 515 } 516 517 /** 518 * @covers WP_REST_Global_Styles_Controller::get_available_actions 519 */ 520 public function test_assign_edit_css_action_admin() { 521 wp_set_current_user( self::$admin_id ); 522 523 $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/' . self::$global_styles_id ); 524 $request->set_param( 'context', 'edit' ); 525 $response = rest_do_request( $request ); 526 $links = $response->get_links(); 527 528 // Admins can only edit css on single site. 529 if ( is_multisite() ) { 530 $this->assertArrayNotHasKey( 'https://api.w.org/action-edit-css', $links ); 531 } else { 532 $this->assertArrayHasKey( 'https://api.w.org/action-edit-css', $links ); 533 } 534 } 516 535 }
Note: See TracChangeset
for help on using the changeset viewer.