Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/30/2016 05:29:28 PM (8 years ago)
Author:
boonebgorges
Message:

Update Messages tests to work after the changes in [11042].

See #7234.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/messages/cache.php

    r9819 r11044  
    1414
    1515        // create the thread
    16         $t1 = $this->factory->message->create( array(
     16        $message_1 = $this->factory->message->create_and_get( array(
    1717            'sender_id'  => $u1,
    1818            'recipients' => array( $u2 ),
     
    2121
    2222        // create a reply
    23         $this->factory->message->create( array(
    24             'thread_id'  => $t1,
     23        $message_2 = $this->factory->message->create_and_get( array(
     24            'thread_id'  => $message_1->thread_id,
    2525            'sender_id'  => $u2,
    2626            'recipients' => array( $u1 ),
     
    2828        ) );
    2929
    30         // grab the message ids as individual variables
    31         list( $m1, $m2 ) = $this->get_message_ids( $t1 );
     30        $m1 = $message_1->id;
     31        $m2 = $message_2->id;
    3232
    3333        // add cache for each message
     
    8686        $u2 = $this->factory->user->create();
    8787
    88         // create the thread
    89         $t1 = $this->factory->message->create( array(
     88        // create the message and thread
     89        $m = $this->factory->message->create_and_get( array(
    9090            'sender_id'  => $u1,
    9191            'recipients' => array( $u2 ),
     
    9494
    9595        // add message cache
    96         list( $m1 ) = $this->get_message_ids( $t1 );
    97         bp_messages_update_meta( $m1, 'yolo', 'gah' );
     96        bp_messages_update_meta( $m->id, 'yolo', 'gah' );
    9897
    9998        // prime meta cache in message loop
    10099        bp_thread_has_messages( array(
    101             'thread_id' => $t1,
     100            'thread_id' => $m->thread_id,
    102101            'update_meta_cache' => true
    103102        ) );
    104103
    105         $this->assertNotEmpty( wp_cache_get( $m1, 'message_meta' ) );
     104        $this->assertNotEmpty( wp_cache_get( $m->id, 'message_meta' ) );
    106105    }
    107106
     
    117116
    118117        // create the thread
    119         $t1 = $this->factory->message->create( array(
     118        $message_1 = $this->factory->message->create_and_get( array(
    120119            'sender_id'  => $u1,
    121120            'recipients' => array( $u2 ),
     
    124123
    125124        // create a reply
    126         $this->factory->message->create( array(
    127             'thread_id'  => $t1,
     125        $message_2 = $this->factory->message->create_and_get( array(
     126            'thread_id'  => $message_1->thread_id,
    128127            'sender_id'  => $u2,
    129128            'recipients' => array( $u1 ),
     
    131130        ) );
    132131
     132        $m1 = $message_1->id;
     133        $m2 = $message_2->id;
     134        $t1 = $message_1->thread_id;
     135
    133136        // add message meta
    134         list( $m1, $m2 ) = $this->get_message_ids( $t1 );
    135137        bp_messages_update_meta( $m1, 'yolo', 'gah' );
    136138        bp_messages_update_meta( $m2, 'yolo', 'bah' );
Note: See TracChangeset for help on using the changeset viewer.