- Timestamp:
- 10/15/2025 08:28:51 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r60251 r60937 2494 2494 } 2495 2495 2496 /** 2497 * @ticket 64049 2498 */ 2499 public function test_update_item_no_content_allow_empty_comment_filter() { 2500 $post_id = self::factory()->post->create(); 2501 2502 wp_set_current_user( self::$admin_id ); 2503 2504 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); 2505 $request->set_param( 'author_email', 'another@email.com' ); 2506 2507 // Sending a request without content is fine. 2508 $response = rest_get_server()->dispatch( $request ); 2509 $this->assertSame( 200, $response->get_status() ); 2510 2511 // Sending a request with empty comment content is also fine. 2512 $request->set_param( 'author_email', 'yetanother@email.com' ); 2513 $request->set_param( 'content', '' ); 2514 add_filter( 'allow_empty_comment', '__return_true' ); 2515 $response = rest_get_server()->dispatch( $request ); 2516 remove_filter( 'allow_empty_comment', '__return_true' ); 2517 $this->assertSame( 200, $response->get_status() ); 2518 } 2519 2496 2520 public function test_update_item_no_change() { 2497 2521 $comment = get_comment( self::$approved_id );
Note: See TracChangeset
for help on using the changeset viewer.