Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/26/2017 11:12:37 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Engagements: Updates existing functions & unit tests:

  • Correct tests so that post_author of 0 does not get included in the overall count
  • Add user IDs to all topics & replies where voice counts are being tested
  • Update voice-count update function to use the new user-relationships API
  • Clean-up topic merge code to more efficiently migrate favorites, subscriptions, and engagements

See #3068.

File:
1 edited

Legend:

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

    r6036 r6330  
    1515     */
    1616    public function test_bbp_insert_topic() {
    17 
     17        $u = $this->factory->user->create_many( 2 );
    1818        $f = $this->factory->forum->create();
    1919
     
    2222
    2323        $t = $this->factory->topic->create( array(
    24             'post_title' => 'Topic 1',
     24            'post_title'   => 'Topic 1',
    2525            'post_content' => 'Content for Topic 1',
    26             'post_parent' => $f,
    27             'post_date' => $post_date,
    28             'topic_meta' => array(
     26            'post_parent'  => $f,
     27            'post_date'    => $post_date,
     28            'post_author'  => $u[0],
     29            'topic_meta'   => array(
    2930                'forum_id' => $f,
    3031            ),
     
    3334        $r = $this->factory->reply->create( array(
    3435            'post_parent' => $t,
    35             'post_date' => $post_date,
    36             'reply_meta' => array(
     36            'post_date'   => $post_date,
     37            'post_author'  => $u[1],
     38            'reply_meta'  => array(
    3739                'forum_id' => $f,
    3840                'topic_id' => $t,
     
    5456        // Topic meta.
    5557        $this->assertSame( $f, bbp_get_topic_forum_id( $t ) );
    56         $this->assertSame( 1, bbp_get_topic_reply_count( $t, true ) );
    57         $this->assertSame( 0, bbp_get_topic_reply_count_hidden( $t, true ) );
    58         $this->assertSame( 1, bbp_get_topic_voice_count( $t, true ) );
     58        $this->assertSame( 1,  bbp_get_topic_reply_count( $t, true ) );
     59        $this->assertSame( 0,  bbp_get_topic_reply_count_hidden( $t, true ) );
     60        $this->assertSame( 2, bbp_get_topic_voice_count( $t, true ) );
    5961        $this->assertSame( $r, bbp_get_topic_last_reply_id( $t ) );
    6062        $this->assertSame( $r, bbp_get_topic_last_active_id( $t ) );
Note: See TracChangeset for help on using the changeset viewer.