- Timestamp:
- 05/03/2022 02:31:12 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/renderCommentTemplate.php
r53329 r53336 137 137 ); 138 138 } 139 140 /** 141 * Test that if pagination is set to display the last page by default (i.e. newest comments), 142 * the query is set to look for page 1 (rather than page 0, which would cause an error). 143 * 144 * Regression: https://github.com/WordPress/gutenberg/issues/40758. 145 * 146 * @ticket 55658 147 * @covers ::build_comment_query_vars_from_block 148 */ 149 function test_build_comment_query_vars_from_block_pagination_with_no_comments() { 150 $comments_per_page = get_option( 'comments_per_page' ); 151 $default_comments_page = get_option( 'default_comments_page' ); 152 153 update_option( 'comments_per_page', 50 ); 154 update_option( 'previous_default_page', 'newest' ); 155 156 $post_without_comments = self::factory()->post->create_and_get( 157 array( 158 'post_type' => 'post', 159 'post_status' => 'publish', 160 'post_name' => 'fluffycat', 161 'post_title' => 'Fluffy Cat', 162 'post_content' => 'Fluffy Cat content', 163 'post_excerpt' => 'Fluffy Cat', 164 ) 165 ); 166 167 $parsed_blocks = parse_blocks( 168 '<!-- wp:comment-template --><!-- wp:comment-author-name /--><!-- wp:comment-content /--><!-- /wp:comment-template -->' 169 ); 170 171 $block = new WP_Block( 172 $parsed_blocks[0], 173 array( 174 'postId' => $post_without_comments->ID, 175 ) 176 ); 177 178 $this->assertSameSetsWithIndex( 179 array( 180 'orderby' => 'comment_date_gmt', 181 'order' => 'ASC', 182 'status' => 'approve', 183 'no_found_rows' => false, 184 'post_id' => $post_without_comments->ID, 185 'hierarchical' => 'threaded', 186 'number' => 50, 187 ), 188 build_comment_query_vars_from_block( $block ) 189 ); 190 191 update_option( 'comments_per_page', $comments_per_page ); 192 update_option( 'default_comments_page', $default_comments_page ); 193 } 194 139 195 140 196 /**
Note: See TracChangeset
for help on using the changeset viewer.