Skip to:
Content

bbPress.org

Ticket #3108: 3108.01.diff

File 3108.01.diff, 4.5 KB (added by thebrandonallen, 8 years ago)
  • src/includes/common/functions.php

    diff --git src/includes/common/functions.php src/includes/common/functions.php
    index f81ea776..0793126d 100644
    function bbp_get_public_child_last_id( $parent_id = 0, $post_type = 'post' ) { 
    14751475                'post_parent' => $parent_id,
    14761476                'post_status' => $post_status,
    14771477                'post_type'   => $post_type,
     1478                'orderby'     => array(
     1479                        'post_date' => 'DESC',
     1480                        'ID'        => 'DESC',
     1481                ),
    14781482
    14791483                // Maybe change these later
    14801484                'posts_per_page'         => 1,
  • src/includes/forums/functions.php

    diff --git src/includes/forums/functions.php src/includes/forums/functions.php
    index 642c7aac..280c5547 100644
    function bbp_exclude_forum_ids( $type = 'string' ) { 
    21432143                                $types['string']     = implode( ',', $forum_ids );
    21442144                                $types['meta_query'] = array(
    21452145                                        'key'     => '_bbp_forum_id',
    2146                                         'value'   => $forum_ids,
     2146                                        'value'   => $types['string'],
    21472147                                        'type'    => 'NUMERIC',
    2148                                         'compare' => $compare
     2148                                        'compare' => $compare,
    21492149                                );
    21502150                        }
    21512151                }
    function bbp_forum_query_last_reply_id( $forum_id = 0, $topic_ids = 0 ) { 
    23352335                'post_parent__in' => $topic_ids,
    23362336                'post_status'     => bbp_get_public_status_id(),
    23372337                'post_type'       => bbp_get_reply_post_type(),
     2338                'orderby'         => array(
     2339                        'post_date' => 'DESC',
     2340                        'ID'        => 'DESC',
     2341                ),
    23382342
    23392343                // Maybe change these later
    23402344                'posts_per_page'         => 1,
  • tests/phpunit/testcases/forums/template/get-last-thing.php

    diff --git tests/phpunit/testcases/forums/template/get-last-thing.php tests/phpunit/testcases/forums/template/get-last-thing.php
    index 9757cac6..11f47a13 100644
    class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { 
    532532                        ),
    533533                ) );
    534534
    535                 $this->factory->reply->create( array(
     535                $r1 = $this->factory->reply->create( array(
    536536                        'post_parent' => $t,
    537537                        'reply_meta' => array(
    538538                                'forum_id' => $f,
    class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { 
    542542
    543543                // Get the forums last reply id.
    544544                $last_reply_id_f = bbp_get_forum_last_reply_id( $f );
    545                 $this->assertSame( $last_reply_id_f, bbp_forum_query_last_reply_id( $f ) );
     545                $this->assertSame( $r1, $last_reply_id_f );
    546546
    547547                // Get the categories last reply id.
    548548                $last_reply_id_c = bbp_get_forum_last_reply_id( $c );
    549                 $this->assertSame( $last_reply_id_c, bbp_forum_query_last_reply_id( $c ) );
     549                $this->assertSame( $r1, $last_reply_id_c );
    550550
    551                 $this->factory->reply->create( array(
     551                $r2 = $this->factory->reply->create( array(
    552552                        'post_parent' => $t,
    553553                        'reply_meta' => array(
    554554                                'forum_id' => $f,
    class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { 
    558558
    559559                // Get the forums last reply id.
    560560                $last_reply_id_f = bbp_get_forum_last_reply_id( $f );
    561                 $this->assertSame( $last_reply_id_f, bbp_forum_query_last_reply_id( $f ) );
     561                $this->assertSame( $r2, $last_reply_id_f );
    562562
    563563                // Get the categories last reply id.
    564564                $last_reply_id_c = bbp_get_forum_last_reply_id( $c );
    565                 $this->assertSame( $last_reply_id_c, bbp_forum_query_last_reply_id( $c ) );
     565                $this->assertSame( $r2, $last_reply_id_c );
    566566        }
    567567
    568568        /**
  • tests/phpunit/testcases/topics/functions/status.php

    diff --git tests/phpunit/testcases/topics/functions/status.php tests/phpunit/testcases/topics/functions/status.php
    index 2f56fde9..71da3bcc 100644
    class BBP_Tests_Topics_Functions_Status extends BBP_UnitTestCase { 
    147147                $this->assertSame( bbp_get_spam_status_id(), $topic_spam_status );
    148148
    149149                $topic_meta_pre_spammed_replies = get_post_meta( $t, '_bbp_pre_spammed_replies', true );
    150                 $this->assertEquals( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies );
     150                $this->assertEqualSets( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies );
    151151
    152152                $topic_spam_meta_status = get_post_meta( $t, '_bbp_spam_meta_status', true );
    153153                $this->assertSame( bbp_get_public_status_id(), $topic_spam_meta_status );
    class BBP_Tests_Topics_Functions_Status extends BBP_UnitTestCase { 
    214214                $this->assertSame( $topic_time, $last_active_time );
    215215
    216216                $topic_meta_pre_spammed_replies = get_post_meta( $t, '_bbp_pre_spammed_replies', true );
    217                 $this->assertEquals( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies );
     217                $this->assertEqualSets( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies );
    218218
    219219                foreach ( $r as $reply ) {
    220220                        $reply_status = get_post_status( $reply );