Skip to:
Content

BuddyPress.org

Ticket #6063: 6063-assoc-array-args-tests.diff

File 6063-assoc-array-args-tests.diff, 1.8 KB (added by Mamaduka, 10 years ago)
  • tests/phpunit/testcases/messages/class.bp-messages-thread.php

    diff --git tests/phpunit/testcases/messages/class.bp-messages-thread.php tests/phpunit/testcases/messages/class.bp-messages-thread.php
    index 047d3b5..f5f2a11 100644
    class BP_Tests_BP_Messages_Thread extends BP_UnitTestCase { 
    2323                        'subject' => 'Bar',
    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 );
    2932                $found = wp_parse_id_list( wp_list_pluck( $threads['threads'], 'thread_id' ) );
    class BP_Tests_BP_Messages_Thread extends BP_UnitTestCase { 
    5053                        'subject' => 'Bar',
    5154                ) );
    5255
     56                $threads = BP_Messages_Thread::get_current_threads_for_user( array(
     57                        'user_id' => $u2,
     58                        'box' => 'setnbox',
     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
    5590                $expected = array( $t2 );