- Timestamp:
- 04/28/2022 01:16:18 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/renderCommentTemplate.php
r53258 r53298 251 251 ); 252 252 } 253 254 /** 255 * Test that unapproved comments are included if it is a preview. 256 * 257 * @ticket 55634 258 * @covers ::build_comment_query_vars_from_block 259 */ 260 function test_build_comment_query_vars_from_block_with_comment_preview() { 261 $parsed_blocks = parse_blocks( 262 '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' 263 ); 264 265 $block = new WP_Block( 266 $parsed_blocks[0], 267 array( 268 'postId' => self::$custom_post->ID, 269 ) 270 ); 271 272 $commenter_filter = function () { 273 return array( 274 'comment_author_email' => 'unapproved@example.org', 275 ); 276 }; 277 278 add_filter( 'wp_get_current_commenter', $commenter_filter ); 279 280 $this->assertEquals( 281 build_comment_query_vars_from_block( $block ), 282 array( 283 'orderby' => 'comment_date_gmt', 284 'order' => 'ASC', 285 'status' => 'approve', 286 'no_found_rows' => false, 287 'include_unapproved' => array( 'unapproved@example.org' ), 288 'post_id' => self::$custom_post->ID, 289 'hierarchical' => 'threaded', 290 'number' => 5, 291 'paged' => 1, 292 ) 293 ); 294 } 253 295 }
Note: See TracChangeset
for help on using the changeset viewer.