Skip to:
Content

BuddyPress.org

Changeset 9302


Ignore:
Timestamp:
01/06/2015 04:10:41 AM (6 years ago)
Author:
r-a-y
Message:

Tests: Add tests for BP_Messages_Thread::get_current_threads_for_user() and BP_Messages_Box_Template

Props Mamaduka.

See #6063.

Location:
trunk/tests/phpunit/testcases/messages
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/messages/class.bp-messages-thread.php

    r9139 r9302  
    2424        ) );
    2525
    26         $threads = BP_Messages_Thread::get_current_threads_for_user( $u2, 'inbox', 'all', null, null, 'ar' );
     26        $threads = BP_Messages_Thread::get_current_threads_for_user( array(
     27            'user_id' => $u2,
     28            'search_terms' => 'ar',
     29        ) );
    2730
    2831        $expected = array( $t2 );
     
    5154        ) );
    5255
     56        $threads = BP_Messages_Thread::get_current_threads_for_user( array(
     57            'user_id' => $u1,
     58            'box' => 'sentbox',
     59            'search_terms' => 'ar',
     60        ) );
     61
     62        $expected = array( $t2 );
     63        $found = wp_parse_id_list( wp_list_pluck( $threads['threads'], 'thread_id' ) );
     64
     65        $this->assertSame( $expected, $found );
     66    }
     67
     68    /**
     69     * @group get_current_threads_for_user
     70     * @expectedDeprecated BP_Messages_Thread::get_current_threads_for_user
     71     */
     72    public function test_get_current_threads_for_user_with_old_args() {
     73        $u1 = $this->factory->user->create();
     74        $u2 = $this->factory->user->create();
     75
     76        $t1 = $this->factory->message->create( array(
     77            'sender_id' => $u1,
     78            'recipients' => array( $u2 ),
     79            'subject' => 'Foo',
     80        ) );
     81
     82        $t2 = $this->factory->message->create( array(
     83            'sender_id' => $u1,
     84            'recipients' => array( $u2 ),
     85            'subject' => 'Bar',
     86        ) );
     87
    5388        $threads = BP_Messages_Thread::get_current_threads_for_user( $u1, 'sentbox', 'all', null, null, 'ar' );
    5489
Note: See TracChangeset for help on using the changeset viewer.