Changeset 64367
- Timestamp:
- 10/15/2026 08:59:04 PM (11 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r64358 r64367 31 31 protected static $num_notes = 10; 32 32 33 protected $endpoint;34 35 33 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 36 34 add_role( … … 170 168 public function set_up() { 171 169 parent::set_up(); 172 $this->endpoint = new WP_REST_Comments_Controller();173 170 wp_create_initial_comment_meta(); 174 171 … … 648 645 wp_set_current_user( 0 ); 649 646 650 $post_id = self::factory()->post->create( array( 'post_status' => 'private' ) );651 652 647 $request = new WP_REST_Request( $method, '/wp/v2/comments' ); 653 $request->set_param( 'post', $post_id );648 $request->set_param( 'post', self::$private_id ); 654 649 $response = rest_get_server()->dispatch( $request ); 655 650 $this->assertErrorResponse( 'rest_cannot_read_post', $response, 401 ); … … 1682 1677 */ 1683 1678 public function test_create_comment_with_invalid_type() { 1684 $post_id = self::factory()->post->create(); 1685 1686 wp_set_current_user( self::$admin_id ); 1687 1688 $params = array( 1689 'post' => $post_id, 1679 wp_set_current_user( self::$admin_id ); 1680 1681 $params = array( 1682 'post' => self::$post_id, 1690 1683 'author' => self::$admin_id, 1691 1684 'author_name' => 'Comic Book Guy', … … 1706 1699 1707 1700 public function test_create_comment_invalid_email() { 1708 $post_id = self::factory()->post->create(); 1709 1710 wp_set_current_user( self::$admin_id ); 1711 1712 $params = array( 1713 'post' => $post_id, 1701 wp_set_current_user( self::$admin_id ); 1702 1703 $params = array( 1704 'post' => self::$post_id, 1714 1705 'author' => self::$admin_id, 1715 1706 'author_name' => 'Comic Book Guy', … … 2522 2513 2523 2514 public function test_update_item_no_content() { 2524 $post_id = self::factory()->post->create();2525 2526 2515 wp_set_current_user( self::$admin_id ); 2527 2516 … … 2544 2533 */ 2545 2534 public function test_update_item_no_content_allow_empty_comment_filter() { 2546 $post_id = self::factory()->post->create();2547 2548 2535 wp_set_current_user( self::$admin_id ); 2549 2536 … … 3878 3865 public function test_cannot_create_with_non_valid_comment_type() { 3879 3866 wp_set_current_user( self::$admin_id ); 3880 $post_id = self::factory()->post->create(); 3881 3882 $params = array( 3883 'post' => $post_id, 3867 3868 $params = array( 3869 'post' => self::$post_id, 3884 3870 'author_name' => 'Ishmael', 3885 3871 'author_email' => 'herman-melville@earthlink.net',
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)