Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/27/2024 04:30:23 PM (18 months ago)
Author:
espellcaste
Message:

Unit Tests: Conducted a thorough review of existing unit tests files and improved them to ensure robustness.

Props imath.

Closes https://github.com/buddypress/buddypress/pull/295
Fixes #9081

File:
1 edited

Legend:

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

    r13357 r13980  
    6161
    6262        // Set the current user so the leave group request goes through.
    63         $this->set_current_user( $u2 );
     63        self::set_current_user( $u2 );
    6464        groups_leave_group( $g1, $u2 );
    6565        $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) );
     
    7979
    8080        // Fool the admin check
    81         $this->set_current_user( $u1 );
     81        self::set_current_user( $u1 );
    8282        buddypress()->is_item_admin = true;
    8383
     
    100100
    101101        // Fool the admin check
    102         $this->set_current_user( $u1 );
     102        self::set_current_user( $u1 );
    103103        buddypress()->is_item_admin = true;
    104104
     
    140140
    141141        $current_user = bp_loggedin_user_id();
    142         $this->set_current_user( $u2 );
     142        self::set_current_user( $u2 );
    143143
    144144        $g = self::factory()->group->create( array( 'status' => 'private' ) );
     
    152152        $this->assertEquals( 1, bp_get_user_meta( $u1, 'total_group_count', true ) );
    153153
    154         $this->set_current_user( $current_user );
     154        self::set_current_user( $current_user );
    155155    }
    156156
     
    168168
    169169        // Fool the admin check
    170         $this->set_current_user( $u1 );
     170        self::set_current_user( $u1 );
    171171        buddypress()->is_item_admin = true;
    172172
     
    227227
    228228        // Fool the admin check
    229         $this->set_current_user( $u1 );
     229        self::set_current_user( $u1 );
    230230        buddypress()->is_item_admin = true;
    231231
     
    248248
    249249        // Fool the admin check
    250         $this->set_current_user( $u1 );
     250        self::set_current_user( $u1 );
    251251        buddypress()->is_item_admin = true;
    252252
     
    311311
    312312        // Fool the admin check
    313         $this->set_current_user( $u1 );
     313        self::set_current_user( $u1 );
    314314        buddypress()->is_item_admin = true;
    315315
     
    382382        ) );
    383383
    384         $this->set_current_user( $u1 );
     384        self::set_current_user( $u1 );
    385385        $g1 = self::factory()->group->create();
    386386
     
    389389        $this->assertEquals( 2, groups_get_total_member_count( $g1 ) );
    390390
    391         $this->set_current_user( $current_user );
     391        self::set_current_user( $current_user );
    392392    }
    393393
Note: See TracChangeset for help on using the changeset viewer.