Skip to:
Content

BuddyPress.org

Changeset 11103


Ignore:
Timestamp:
09/14/2016 10:20:39 PM (5 years ago)
Author:
boonebgorges
Message:

Groups: Ensure that isset() returns true for newly-protected properties in BP_Groups_Group.

Props r-a-y.
Fixes #5451.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/classes/class-bp-groups-group.php

    r11100 r11103  
    441441    public function __isset( $key ) {
    442442        switch ( $key ) {
     443            case 'admins' :
     444            case 'is_invited' :
     445            case 'is_member' :
     446            case 'is_pending' :
    443447            case 'last_activity' :
     448            case 'mods' :
    444449            case 'total_member_count' :
    445             case 'admins' :
    446             case 'mods' :
     450            case 'user_has_access' :
    447451                return true;
    448452
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-group.php

    r11095 r11103  
    677677    }
    678678
     679    /**
     680     * @ticket BP5451
     681     */
     682    public function test_bp_groups_group_magic_isset_with_empty_check() {
     683        $this->old_current_user = get_current_user_id();
     684
     685        $u = $this->factory->user->create();
     686        $g = $this->factory->group->create( array( 'creator_id' => $u ) );
     687
     688        // Instantiate group object.
     689        $this->set_current_user( $u );
     690        $group = new BP_Groups_Group( $g );
     691
     692        // Assert ! empty() check is not false.
     693        $this->assertNotFalse( ! empty( $group->is_member ) );
     694
     695        $this->set_current_user( $this->old_current_user );
     696    }
     697
    679698    /** convert_type_to_order_orderby() **********************************/
    680699
Note: See TracChangeset for help on using the changeset viewer.