Skip to:
Content

bbPress.org

Changeset 5953


Ignore:
Timestamp:
11/18/2015 03:01:06 AM (9 years ago)
Author:
netweb
Message:

Tests: More tests for the common component query functions:

  • test_bbp_query_post_parent__in() for bbp_query_post_parent__in()
  • test_bbp_get_public_child_last_id() for bbp_get_public_child_last_id()

See #1799

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/common/query.php

    r5791 r5953  
    1010class BBP_Tests_Common_Functions_Query extends BBP_UnitTestCase {
    1111
     12    /**
     13     * @covers ::bbp_query_post_parent__in
     14     * @todo   Implement test_bbp_query_post_parent__in().
     15     */
     16    public function test_bbp_query_post_parent__in() {
     17        // Remove the following lines when you implement this test.
     18        $this->markTestIncomplete(
     19            'This test has not been implemented yet.'
     20        );
     21    }
     22
     23    /**
     24     * @covers ::bbp_get_public_child_last_id
     25     */
     26    public function test_bbp_get_public_child_last_id() {
     27        $f = $this->factory->forum->create();
     28
     29        $t = $this->factory->topic->create( array(
     30            'post_parent' => $f,
     31            'topic_meta' => array(
     32                'forum_id' => $f,
     33            ),
     34        ) );
     35
     36        $last_id = bbp_get_public_child_last_id( $f, bbp_get_topic_post_type() );
     37        $this->assertSame( $t, $last_id );
     38
     39        $r = $this->factory->reply->create( array(
     40            'post_parent' => $t,
     41            'reply_meta' => array(
     42                'forum_id' => $f,
     43                'topic_id' => $t,
     44            ),
     45        ) );
     46
     47        $last_id = bbp_get_public_child_last_id( $t, bbp_get_reply_post_type() );
     48        $this->assertSame( $r, $last_id );
     49    }
     50
    1251    /**
    1352     * @group  counts
Note: See TracChangeset for help on using the changeset viewer.