Skip to:
Content

BuddyPress.org

Ticket #5451: 5451.isset.patch

File 5451.isset.patch, 1.3 KB (added by r-a-y, 7 years ago)
  • src/bp-groups/classes/class-bp-groups-group.php

     
    447447                                return true;
    448448
    449449                        default :
    450                                 return false;
     450                                return (bool) $this->__get( $key );
    451451                }
    452452        }
    453453
  • tests/phpunit/testcases/groups/class-bp-groups-group.php

     
    18311831                $found = wp_list_pluck( $groups['groups'], 'id' );
    18321832                $this->assertEqualSets( array( $g1, $g4 ), $found );
    18331833        }
     1834
     1835        /**
     1836         * @group magic
     1837         */
     1838        public function test_bp_groups_group_magic_isset_with_empty_check() {
     1839                $this->old_current_user = get_current_user_id();
     1840
     1841                $u = $this->factory->user->create();
     1842                $g = $this->factory->group->create( array( 'creator_id' => $u ) );
     1843
     1844                // Instantiate group object.
     1845                $this->set_current_user( $u );
     1846                $group = new BP_Groups_Group( $g );
     1847
     1848                // Assert ! empty() check is not false.
     1849                $this->assertNotFalse( ! empty( $group->is_member ) );
     1850
     1851                $this->set_current_user( $this->old_current_user );
     1852        }
    18341853}
    18351854
    18361855/**