Skip to:
Content

BuddyPress.org

Ticket #6596: 6596.diff

File 6596.diff, 1.4 KB (added by boonebgorges, 10 years ago)
  • tests/phpunit/testcases/notifications/functions.php

    diff --git tests/phpunit/testcases/notifications/functions.php tests/phpunit/testcases/notifications/functions.php
    index 60e325a..8ff5ed2 100644
    class BP_Tests_Notifications_Functions extends BP_UnitTestCase { 
    124124        }
    125125
    126126        /**
     127         * @group cache
     128         * @ticket BP6596
     129         */
     130        public function test_cache_invalidation_all_for_user_on_bp_notification_mark_notification() {
     131                $u  = $this->factory->user->create();
     132                $n1 = $this->factory->notification->create( array(
     133                        'component_name' => 'groups',
     134                        'user_id'        => $u
     135                ) );
     136
     137                $this->factory->notification->create( array(
     138                        'component_name' => 'messages',
     139                        'user_id'        => $u
     140                ) );
     141
     142                // prime cache
     143                $count = bp_notifications_get_unread_notification_count( $u );
     144
     145                // just to be sure...
     146                $this->assertEquals( 2, $count, 'Cache count should be 2 before invalidation.' );
     147                print_r( wp_cache_get( 'all_for_user_' . $u, 'bp_notifications' ) );
     148
     149                $this->set_current_user( $u );
     150
     151                // mark one notification as read
     152                bp_notifications_mark_notification( $n1, false );
     153
     154                $this->assertFalse( wp_cache_get( 'all_for_user_' . $u, 'bp_notifications' ) );
     155        }
     156
     157        /**
    127158         * @group bp_notifications_add_notification
    128159         */
    129160        public function test_bp_notifications_add_notification_no_dupes() {