Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/27/2024 04:30:23 PM (6 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/core/nav/bpCoreMaybeHookNewSubnavScreenFunction.php

    r13437 r13980  
    4949    public function test_user_has_access_false_user_logged_out() {
    5050        $old_current_user = get_current_user_id();
    51         $this->set_current_user( 0 );
     51        self::set_current_user( 0 );
    5252
    5353        $subnav_item = array(
     
    6262        $this->assertSame( $expected, bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ) );
    6363
    64         $this->set_current_user( $old_current_user );
     64        self::set_current_user( $old_current_user );
    6565    }
    6666
     
    6868        $u = self::factory()->user->create();
    6969        $old_current_user = get_current_user_id();
    70         $this->set_current_user( $u );
     70        self::set_current_user( $u );
    7171        $this->set_permalink_structure( '/%postname%/' );
    7272
     
    8282        $this->assertSame( bp_members_get_user_url( $u ), $found['redirect_args']['root'] );
    8383
    84         $this->set_current_user( $old_current_user );
     84        self::set_current_user( $old_current_user );
    8585    }
    8686
     
    8989        $u2 = self::factory()->user->create();
    9090        $old_current_user = get_current_user_id();
    91         $this->set_current_user( $u1 );
     91        self::set_current_user( $u1 );
    9292        $this->set_permalink_structure( '/%postname%/' );
    9393
     
    113113
    114114        // Clean up
    115         $this->set_current_user( $old_current_user );
     115        self::set_current_user( $old_current_user );
    116116        buddypress()->default_component = $old_default_component;
    117117        buddypress()->bp_nav = $old_bp_nav;
     
    125125        $u2 = self::factory()->user->create();
    126126        $old_current_user = get_current_user_id();
    127         $this->set_current_user( $u1 );
     127        self::set_current_user( $u1 );
    128128        $this->set_permalink_structure( '/%postname%/' );
    129129
     
    150150
    151151        // Clean up
    152         $this->set_current_user( $old_current_user );
     152        self::set_current_user( $old_current_user );
    153153        buddypress()->default_component = $old_default_component;
    154154        buddypress()->bp_nav = $old_bp_nav;
     
    170170        $g = self::factory()->group->create();
    171171        $old_current_user = get_current_user_id();
    172         $this->set_current_user( $u );
     172        self::set_current_user( $u );
    173173        $this->set_permalink_structure( '/%postname%/' );
    174174
     
    188188
    189189        // Clean up
    190         $this->set_current_user( $old_current_user );
     190        self::set_current_user( $old_current_user );
    191191    }
    192192
     
    195195        $g = self::factory()->group->create();
    196196        $old_current_user = get_current_user_id();
    197         $this->set_current_user( $u );
     197        self::set_current_user( $u );
    198198
    199199        $group = groups_get_group( $g );
     
    211211
    212212        // Clean up
    213         $this->set_current_user( $old_current_user );
     213        self::set_current_user( $old_current_user );
    214214    }
    215215}
Note: See TracChangeset for help on using the changeset viewer.