Skip to:
Content

bbPress.org

Changeset 7804


Ignore:
Timestamp:
10/04/2026 09:34:34 AM (3 weeks ago)
Author:
johnjamesjacoby
Message:

Tests: Cover threaded reply list output.

Verify supported and fallback wrappers, pagination state, and reply-loop cleanup using a controlled walker.

In trunk, for 2.7.

See #3695.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/replies/functions/reply.php

    r7803 r7804  
    580580        /**
    581581         * @covers ::bbp_list_replies
    582          * @todo   Implement test_bbp_list_replies().
    583582         */
    584583        public function test_bbp_list_replies() {
    585                 // Remove the following lines when you implement this test.
    586                 $this->markTestIncomplete(
    587                         'This test has not been implemented yet.'
    588                 );
     584                $bbp       = bbpress();
     585                $old_query = $bbp->reply_query;
     586                $old_pages = $bbp->max_num_pages;
     587                $walker    = new class {
     588                        public $max_pages = 2;
     589
     590                        public function paged_walk() {
     591                                return '<li>Reply</li>';
     592                        }
     593                };
     594                $bbp->reply_query = (object) array( 'posts' => array() );
     595
     596                try {
     597                        ob_start();
     598                        bbp_list_replies( array( 'walker' => $walker, 'style' => 'div' ) );
     599                        $this->assertSame( "<div class='bbp-replies-list'><li>Reply</li></div>", ob_get_clean() );
     600                        $this->assertSame( 2, $bbp->max_num_pages );
     601                        $this->assertFalse( $bbp->reply_query->in_the_loop );
     602                        ob_start();
     603                        bbp_list_replies( array( 'walker' => $walker, 'style' => 'table' ) );
     604                        $this->assertSame( "<ul class='bbp-replies-list'><li>Reply</li></ul>", ob_get_clean() );
     605                } finally {
     606                        $bbp->reply_query   = $old_query;
     607                        $bbp->max_num_pages = $old_pages;
     608                }
    589609        }
    590610
Note: See TracChangeset for help on using the changeset viewer.