Changeset 11044 for trunk/tests/phpunit/testcases/messages/cache.php
- Timestamp:
- 08/30/2016 05:29:28 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/messages/cache.php
r9819 r11044 14 14 15 15 // create the thread 16 $ t1 = $this->factory->message->create( array(16 $message_1 = $this->factory->message->create_and_get( array( 17 17 'sender_id' => $u1, 18 18 'recipients' => array( $u2 ), … … 21 21 22 22 // 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, 25 25 'sender_id' => $u2, 26 26 'recipients' => array( $u1 ), … … 28 28 ) ); 29 29 30 // grab the message ids as individual variables31 list( $m1, $m2 ) = $this->get_message_ids( $t1 );30 $m1 = $message_1->id; 31 $m2 = $message_2->id; 32 32 33 33 // add cache for each message … … 86 86 $u2 = $this->factory->user->create(); 87 87 88 // create the thread89 $ t1 = $this->factory->message->create( array(88 // create the message and thread 89 $m = $this->factory->message->create_and_get( array( 90 90 'sender_id' => $u1, 91 91 'recipients' => array( $u2 ), … … 94 94 95 95 // 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' ); 98 97 99 98 // prime meta cache in message loop 100 99 bp_thread_has_messages( array( 101 'thread_id' => $ t1,100 'thread_id' => $m->thread_id, 102 101 'update_meta_cache' => true 103 102 ) ); 104 103 105 $this->assertNotEmpty( wp_cache_get( $m 1, 'message_meta' ) );104 $this->assertNotEmpty( wp_cache_get( $m->id, 'message_meta' ) ); 106 105 } 107 106 … … 117 116 118 117 // create the thread 119 $ t1 = $this->factory->message->create( array(118 $message_1 = $this->factory->message->create_and_get( array( 120 119 'sender_id' => $u1, 121 120 'recipients' => array( $u2 ), … … 124 123 125 124 // 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, 128 127 'sender_id' => $u2, 129 128 'recipients' => array( $u1 ), … … 131 130 ) ); 132 131 132 $m1 = $message_1->id; 133 $m2 = $message_2->id; 134 $t1 = $message_1->thread_id; 135 133 136 // add message meta 134 list( $m1, $m2 ) = $this->get_message_ids( $t1 );135 137 bp_messages_update_meta( $m1, 'yolo', 'gah' ); 136 138 bp_messages_update_meta( $m2, 'yolo', 'bah' );
Note: See TracChangeset
for help on using the changeset viewer.