- Timestamp:
- 10/08/2018 10:44:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/tests/phpunit/tests/rest-api/rest-posts-controller.php
r43445 r43682 3591 3591 } 3592 3592 3593 public function test_assign_unfiltered_html_action_superadmin() { 3594 $post_id = self::factory()->post->create(); 3595 wp_set_current_user( self::$superadmin_id ); 3596 $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id ); 3597 $request->set_param( 'context', 'edit' ); 3598 $response = rest_do_request( $request ); 3599 $links = $response->get_links(); 3600 $this->assertArrayHasKey( 'https://api.w.org/action-unfiltered-html', $links ); 3601 } 3602 3603 public function test_assign_unfiltered_html_action_editor() { 3604 $post_id = self::factory()->post->create(); 3605 wp_set_current_user( self::$editor_id ); 3606 $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id ); 3607 $request->set_param( 'context', 'edit' ); 3608 $response = rest_do_request( $request ); 3609 $links = $response->get_links(); 3610 // Editors can only unfiltered html on single site. 3611 if ( is_multisite() ) { 3612 $this->assertArrayNotHasKey( 'https://api.w.org/action-unfiltered-html', $links ); 3613 } else { 3614 $this->assertArrayHasKey( 'https://api.w.org/action-unfiltered-html', $links ); 3615 } 3616 } 3617 3618 public function test_assign_unfiltered_html_action_author() { 3619 $post_id = self::factory()->post->create(); 3620 wp_set_current_user( self::$author_id ); 3621 $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id ); 3622 $request->set_param( 'context', 'edit' ); 3623 $response = rest_do_request( $request ); 3624 $links = $response->get_links(); 3625 // Authors can't ever unfiltered html 3626 $this->assertArrayNotHasKey( 'https://api.w.org/action-unfiltered-html', $links ); 3627 } 3628 3593 3629 public function tearDown() { 3594 3630 _unregister_post_type( 'youseeeme' );
Note: See TracChangeset
for help on using the changeset viewer.