Skip to:
Content

bbPress.org

Changeset 5773


Ignore:
Timestamp:
05/19/2015 01:20:09 AM (10 years ago)
Author:
netweb
Message:

Tests: Add post meta test assertions to test_bbp_create_initial_content(), see #2805

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/update.php

    r5713 r5773  
    7575
    7676    /**
     77     * @group canonical
    7778     * @covers ::bbp_create_initial_content
    7879     */
     
    8384        $topic_id = 4;
    8485        $reply_id = 5;
     86        $now = 'right now';
    8587
     88        // Forum post
    8689        $this->assertSame( 'General', bbp_get_forum_title( $forum_id ) );
    8790        $this->assertSame( 'General chit-chat', bbp_get_forum_content( $forum_id ) );
    8891        $this->assertSame( 'open', bbp_get_forum_status( $forum_id ) );
    8992        $this->assertTrue( bbp_is_forum_public( $forum_id ) );
     93        $this->assertSame( 0, bbp_get_forum_parent_id( $forum_id ) );
    9094
     95        // Topic post
    9196        $this->assertSame( $forum_id, bbp_get_topic_forum_id( $topic_id ) );
    9297        $this->assertSame( 'Hello World!', bbp_get_topic_title( $topic_id ) );
     
    97102        $this->assertTrue( bbp_is_topic_published( $topic_id ) );
    98103
     104        // Reply post
    99105        $this->assertSame( $forum_id, bbp_get_reply_forum_id( $reply_id ) );
    100106        $this->assertSame( 'Reply To: Hello World!', bbp_get_reply_title( $reply_id ) );
     
    105111        $this->assertSame( 'publish', bbp_get_reply_status( $reply_id ) );
    106112        $this->assertTrue( bbp_is_reply_published( $reply_id ) );
     113
     114        // Forum meta
     115        $this->assertSame( 0, bbp_get_forum_subforum_count( $forum_id, true ) );
     116        $this->assertSame( 1, bbp_get_forum_topic_count( $forum_id, false, true ) );
     117        $this->assertSame( 0, bbp_get_forum_topic_count_hidden( $forum_id, true ) );
     118        $this->assertSame( 1, bbp_get_forum_reply_count( $forum_id, false, true ) );
     119        $this->assertSame( 1, bbp_get_forum_topic_count( $forum_id, true, true ) );
     120        $this->assertSame( 1, bbp_get_forum_reply_count( $forum_id, true, true ) );
     121        $this->assertSame( 2, bbp_get_forum_post_count( $forum_id, false, true ) );
     122        $this->assertSame( 2, bbp_get_forum_post_count( $forum_id, true, true ) );
     123        $this->assertSame( $topic_id, bbp_get_forum_last_topic_id( $forum_id ) );
     124        $this->assertSame( 'Hello World!', bbp_get_forum_last_topic_title( $forum_id ) );
     125        $this->assertSame( $reply_id, bbp_get_forum_last_reply_id( $forum_id ) );
     126        $this->assertSame( 'Reply To: Hello World!', bbp_get_forum_last_reply_title( $forum_id ) );
     127        $this->assertSame( $reply_id, bbp_get_forum_last_active_id( $forum_id ) );
     128        $this->assertSame( $now, bbp_get_forum_last_active_time( $forum_id ) );
     129
     130        // Topic meta
     131        $this->assertSame( '0.0.0.0', bbp_current_author_ip( $topic_id ) );
     132        $this->assertSame( $forum_id, bbp_get_topic_forum_id( $topic_id ) );
     133        $this->assertSame( 1, bbp_get_topic_voice_count( $topic_id, true ) );
     134        $this->assertSame( 1, bbp_get_topic_reply_count( $topic_id, true ) );
     135        $this->assertSame( 0, bbp_get_topic_reply_count_hidden( $topic_id, true ) );
     136        $this->assertSame( $reply_id, bbp_get_topic_last_reply_id( $topic_id ) );
     137        $this->assertSame( $reply_id, bbp_get_topic_last_active_id( $topic_id ) );
     138        $this->assertSame( $now, bbp_get_topic_last_active_time( $topic_id ) );
     139
     140        // Reply Meta
     141        $this->assertSame( '0.0.0.0', bbp_current_author_ip( $reply_id ) );
     142        $this->assertSame( $forum_id, bbp_get_reply_forum_id( $reply_id ) );
     143        $this->assertSame( $topic_id, bbp_get_reply_topic_id( $reply_id ) );
    107144    }
    108145
Note: See TracChangeset for help on using the changeset viewer.