Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/14/2017 01:37:35 AM (8 years ago)
Author:
dcavins
Message:

BP_Groups_Group: Refactor some fetching functions.

Rewrite BP_Groups_Group::filter_user_groups,
BP_Groups_Group::search_groups, BP_Groups_Group::get_random, and
BP_Groups_Group::get_by_letter to use BP_Groups_Group::get(). Using
get() means that incrementor-based caching will be applied to the
queries and that get_group_extras() can be removed in several places.

Fixes #7419.

File:
1 edited

Legend:

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

    r11383 r11384  
    10931093    }
    10941094
     1095    public function test_get_by_letter_typical_use() {
     1096        $g1 = $this->factory->group->create( array(
     1097            'name' => 'Awesome Cool Group',
     1098            'description' => 'Neat',
     1099        ) );
     1100        $g2 = $this->factory->group->create( array(
     1101            'name' => 'Babylon Kong',
     1102            'description' => 'Awesome',
     1103        ) );
     1104
     1105        $groups = BP_Groups_Group::get_by_letter( 'A' );
     1106
     1107        $found = wp_list_pluck( $groups['groups'], 'id' );
     1108
     1109        $this->assertEquals( array( $g1 ), $found );
     1110
     1111    }
     1112
    10951113    public function test_get_by_letter_with_exclude() {
    10961114        $g1 = $this->factory->group->create( array(
Note: See TracChangeset for help on using the changeset viewer.