Make WordPress Core


Ignore:
Timestamp:
09/23/2024 12:48:32 PM (23 months ago)
Author:
gziolo
Message:

Comments: Pass $page as argument to comments functions

Removes query alteration from build_comment_query_vars_from_block by introducing a new way to pass the $page as argument to functions handling pagination for the comments.

Props cybr, santosguillamot, bernhard-reiter, gziolo.
Fixes #60806.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/renderCommentTemplate.php

    r56559 r59081  
    220220         * Test that both "Older Comments" and "Newer Comments" are displayed in the correct order
    221221         * inside the Comment Query Loop when we enable pagination on Discussion Settings.
    222          * In order to do that, it should exist a query var 'cpage' set with the $comment_args['paged'] value.
    223222         *
    224223         * @ticket 55505
     224         * @ticket 60806
    225225         * @covers ::build_comment_query_vars_from_block
    226226         */
    227         public function test_build_comment_query_vars_from_block_sets_cpage_var() {
     227        public function test_build_comment_query_vars_from_block_sets_max_num_pages() {
    228228
    229229                // This could be any number, we set a fixed one instead of a random for better performance.
     
    254254                $actual = build_comment_query_vars_from_block( $block );
    255255                $this->assertSame( $comment_query_max_num_pages, $actual['paged'] );
    256                 $this->assertSame( $comment_query_max_num_pages, get_query_var( 'cpage' ) );
    257256        }
    258257
Note: See TracChangeset for help on using the changeset viewer.