Skip to:
Content

BuddyPress.org

Changeset 7112


Ignore:
Timestamp:
05/27/2013 11:27:08 PM (13 years ago)
Author:
boonebgorges
Message:

Adds tests for 'type=popular' BP_Groups_Group::get()

see r7087, r7111

File:
1 edited

Legend:

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

    r7090 r7112  
    214214        }
    215215
     216        /**
     217         * @group get
     218         */
     219        public function test_get_with_type_popular() {
     220                $g1 = $this->factory->group->create( array(
     221                        'name' => 'A Group',
     222                        'date_created' => bp_core_current_time(),
     223                ) );
     224                $g2 = $this->factory->group->create( array(
     225                        'name' => 'D Group',
     226                        'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100 ),
     227                ) );
     228                $g3 = $this->factory->group->create( array(
     229                        'name' => 'B Group',
     230                        'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100000 ),
     231                ) );
     232                $g4 = $this->factory->group->create( array(
     233                        'name' => 'C Group',
     234                        'date_created' => gmdate( 'Y-m-d H:i:s', $time - 1000 ),
     235                ) );
     236
     237                groups_update_groupmeta( $g1, 'total_member_count', 1 );
     238                groups_update_groupmeta( $g2, 'total_member_count', 4 );
     239                groups_update_groupmeta( $g3, 'total_member_count', 2 );
     240                groups_update_groupmeta( $g4, 'total_member_count', 3 );
     241
     242                $groups = BP_Groups_Group::get( array( 'type' => 'popular' ) );
     243                $found = wp_parse_id_list( wp_list_pluck( $groups['groups'], 'id' ) );
     244                $this->assertEquals( array( $g2, $g4, $g3, $g1 ), $found );
     245        }
     246
    216247        /** convert_type_to_order_orderby() **********************************/
    217248
    … …  
    303334         * @group convert_orderby_to_order_by_term
    304335         */
    305         public function test_convert_orderby_to_order_by_term_total_group_members() {
     336        public function test_convert_orderby_to_order_by_term_total_member_count() {
    306337                $c = new _BP_Groups_Group();
    307                 $this->assertEquals( 'CONVERT(gm1.meta_value, SIGNED)', _BP_Groups_Group::_convert_orderby_to_order_by_term( 'total_group_members' ) );
     338                $this->assertEquals( 'CONVERT(gm1.meta_value, SIGNED)', _BP_Groups_Group::_convert_orderby_to_order_by_term( 'total_member_count' ) );
    308339        }
    309340
Note: See TracChangeset for help on using the changeset viewer.