Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/22/2015 09:36:23 AM (10 years ago)
Author:
netweb
Message:

Tests: Adds forum, topic and reply insert function tests:

  • test_bbp_insert_forum() for bbp_insert_forum()
  • test_bbp_insert_topic() for bbp_insert_topic()
  • test_bbp_insert_reply() for bbp_insert_reply()

Props netweb. Fixes #2805

File:
1 edited

Legend:

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

    r5763 r5779  
    1111
    1212    /**
     13     * @group canonical
    1314     * @covers ::bbp_insert_reply
    14      * @todo   Implement test_bbp_insert_reply().
    1515     */
    1616    public function test_bbp_insert_reply() {
    17         // Remove the following lines when you implement this test.
    18         $this->markTestIncomplete(
    19             'This test has not been implemented yet.'
    20         );
     17
     18        $f = $this->factory->forum->create();
     19
     20        $t = $this->factory->topic->create( array(
     21            'post_parent' => $f,
     22            'topic_meta' => array(
     23                'forum_id' => $f,
     24            ),
     25        ) );
     26
     27        $r = $this->factory->reply->create( array(
     28            'post_parent' => $t,
     29            'reply_meta' => array(
     30                'forum_id' => $f,
     31                'topic_id' => $t,
     32            ),
     33        ) );
     34
     35        // reply post
     36        $this->assertSame( 'Reply To: Topic 1', bbp_get_reply_title( $r ) );
     37        $this->assertSame( 'publish', bbp_get_reply_status( $r ) );
     38        $this->assertSame( $t, wp_get_post_parent_id( $r ) ); // post parent
     39
     40        // reply meta
     41        $this->assertSame( $f, bbp_get_reply_forum_id( $r ) ); // _bbp_forum_id
     42        $this->assertSame( $t, bbp_get_reply_topic_id( $r ) ); // _bbp_forum_id
    2143    }
    2244
Note: See TracChangeset for help on using the changeset viewer.