Skip to:
Content

bbPress.org

Changeset 5915


Ignore:
Timestamp:
08/15/2015 07:53:22 AM (6 years ago)
Author:
netweb
Message:

Tests: Add test_bbp_delete_topic_replies() topics function test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/topics/functions/topic.php

    r5863 r5915  
    359359    /**
    360360     * @covers ::bbp_delete_topic_replies
    361      * @todo   Implement test_bbp_delete_topic_replies().
    362361     */
    363362    public function test_bbp_delete_topic_replies() {
    364         // Remove the following lines when you implement this test.
    365         $this->markTestIncomplete(
    366             'This test has not been implemented yet.'
    367         );
     363        $f = $this->factory->forum->create();
     364        $t = $this->factory->topic->create( array(
     365            'post_parent' => $f,
     366            'topic_meta' => array(
     367                'forum_id' => $f,
     368            ),
     369        ) );
     370        $r = $this->factory->reply->create_many( 2, array(
     371            'post_parent' => $t,
     372            'reply_meta' => array(
     373                'forum_id' => $f,
     374                'topic_id' => $t,
     375            ),
     376        ) );
     377
     378        $this->assertSame( 2, bbp_get_topic_reply_count( $t, true ) );
     379
     380        bbp_delete_topic_replies( $t );
     381
     382        $count = count( bbp_get_all_child_ids( $t, bbp_get_reply_post_type() ) );
     383        $this->assertSame( 0, ( $count ) );
    368384    }
    369385
Note: See TracChangeset for help on using the changeset viewer.