Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/08/2016 02:11:17 AM (10 years ago)
Author:
boonebgorges
Message:

When a group membership request is approved or rejected, mark all related notifications as read.

Fixes #7375.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/groups/notifications.php

    r9819 r11278  
    219219                return $value;
    220220        }
     221
     222        /**
     223         * @group BP7375
     224         */
     225        public function test_membership_request_notifications_should_be_cleared_when_request_is_accepted() {
     226                $users = $this->factory->user->create_many( 3 );
     227
     228                $this->add_user_to_group( $users[0], $this->group, array(
     229                        'is_admin' => 1,
     230                ) );
     231                $this->add_user_to_group( $users[1], $this->group, array(
     232                        'is_admin' => 1,
     233                ) );
     234
     235                groups_send_membership_request( $users[2], $this->group );
     236
     237                // Both admins should get a notification.
     238                $get_args = array(
     239                        'user_id' => $users[0],
     240                        'item_id' => $this->group,
     241                        'secondary_item_id' => $users[2],
     242                        'component_action' => 'new_membership_request',
     243                        'is_new' => true,
     244                );
     245                $u0_notifications = BP_Notifications_Notification::get( $get_args );
     246                $u1_notifications = BP_Notifications_Notification::get( $get_args );
     247                $this->assertNotEmpty( $u0_notifications );
     248                $this->assertNotEmpty( $u1_notifications );
     249
     250                $this->assertTrue( groups_invite_user( array(
     251                        'user_id' => $users[2],
     252                        'group_id' => $this->group,
     253                ) ) );
     254
     255                $u0_notifications = BP_Notifications_Notification::get( $get_args );
     256                $u1_notifications = BP_Notifications_Notification::get( $get_args );
     257                $this->assertEmpty( $u0_notifications );
     258                $this->assertEmpty( $u1_notifications );
     259        }
     260
    221261}
Note: See TracChangeset for help on using the changeset viewer.