Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/10/2015 01:07:23 PM (11 years ago)
Author:
djpaul
Message:

Groups: new function to get groups from which a user is banned.

Fixes #6562

props lenasterg

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php

    r9900 r10227  
    9494    }
    9595
     96    public function test_get_is_banned_of_with_filter() {
     97        $g1 = $this->factory->group->create( array(
     98            'name' => 'RC Cola',
     99        ) );
     100        $g2 = $this->factory->group->create( array(
     101            'name' => 'Pepsi',
     102        ) );
     103
     104        $u = $this->factory->user->create();
     105        self::add_user_to_group( $u, $g1 );
     106        self::add_user_to_group( $u, $g2 );
     107
     108        $m1 = new BP_Groups_Member( $u, $g1 );
     109        $m1->ban();
     110        $m2 = new BP_Groups_Member( $u, $g2 );
     111        $m2->ban();
     112
     113        $groups = BP_Groups_Member::get_is_banned_of( $u, false, false, 'eps' );
     114
     115        $ids = wp_list_pluck( $groups['groups'], 'id' );
     116        $this->assertEquals( $ids, array( $g2 ) );
     117    }
     118
    96119    public function test_get_invites_with_exclude() {
    97120        $g1 = $this->factory->group->create( array(
Note: See TracChangeset for help on using the changeset viewer.