Skip to:
Content

BuddyPress.org

Changeset 9562


Ignore:
Timestamp:
02/27/2015 03:18:45 AM (9 years ago)
Author:
boonebgorges
Message:

Ensure a current user is set in test_total_group_count_groups_accept_membership_request().

In versions of WP prior to 4.1, the failure to have a current user was causing
a PHP notice to be thrown.

See #6009.

File:
1 edited

Legend:

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

    r9561 r9562  
    110110     */
    111111    public function test_total_group_count_groups_accept_membership_request() {
    112         $u = $this->factory->user->create();
    113         $g = $this->factory->group->create();
    114         groups_send_membership_request( $u, $g );
    115 
    116         groups_accept_membership_request( 0, $u, $g );
    117 
    118         $this->assertEquals( 1, bp_get_user_meta( $u, 'total_group_count', true ) );
     112        $u1 = $this->factory->user->create();
     113        $u2 = $this->factory->user->create();
     114
     115        $current_user = bp_loggedin_user_id();
     116        $this->set_current_user( $u2 );
     117
     118        $g = $this->factory->group->create();
     119        groups_send_membership_request( $u1, $g );
     120
     121        groups_accept_membership_request( 0, $u1, $g );
     122
     123        $this->assertEquals( 1, bp_get_user_meta( $u1, 'total_group_count', true ) );
     124
     125        $this->set_current_user( $current_user );
    119126    }
    120127
Note: See TracChangeset for help on using the changeset viewer.