Changeset 8176
- Timestamp:
- 03/27/2014 07:04:30 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-notifications/bp-notifications-classes.php
r8171 r8176 662 662 $where = self::get_query_clauses( $where_args ); 663 663 664 // make sure we delete the notification cache for the user on update 665 if ( ! empty( $where_args['user_id'] ) ) { 666 wp_cache_delete( 'all_for_user_' . $where_args['user_id'], 'bp_notifications' ); 667 } 668 664 669 return self::_update( $update['data'], $where['data'], $update['format'], $where['format'] ); 665 670 } -
trunk/tests/testcases/notifications/functions.php
r8102 r8176 91 91 $this->assertNotEmpty( bp_notifications_add_notification( $args ) ); 92 92 } 93 94 /** 95 * @group bp_notifications_get_unread_notification_count 96 * @group cache 97 */ 98 public function test_bp_notifications_get_unread_notification_count_cache() { 99 $u1 = $this->create_user(); 100 $u2 = $this->create_user(); 101 102 $n1 = $this->factory->notification->create( array( 103 'component_name' => 'messages', 104 'component_action' => 'new_message', 105 'item_id' => 99, 106 'user_id' => $u2, 107 'secondary_item_id' => $u1, 108 'is_new' => true, 109 ) ); 110 111 // prime cache 112 bp_notifications_get_unread_notification_count( $u2 ); 113 114 // mark the created notification as read 115 bp_notifications_mark_notifications_by_item_id( $u2, 99, 'messages', 'new_message', $u1 ); 116 117 // now grab the updated notification count 118 $n = bp_notifications_get_unread_notification_count( $u2 ); 119 120 // assert 121 $this->assertEquals( 0, $n ); 122 } 93 123 }
Note: See TracChangeset
for help on using the changeset viewer.