Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/28/2014 11:24:06 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Backwards compatibility for querying single groups via the slug argument. Props r-a-y. Fixes #5596. (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/groups/template.php

    r8069 r8329  
    9797        $ids = wp_parse_id_list( wp_list_pluck( $groups_template->groups, 'id' ) );
    9898        $this->assertEquals( array( $g1, $g3, $g2, ), $ids );
     99    }
     100
     101    /**
     102     * Test using the 'slug' parameter in bp_has_groups()
     103     *
     104     * Note: The 'slug' parameter currently also requires the 'type' to be set
     105     * to 'single-group'.
     106     *
     107     * @group bp_has_groups
     108     */
     109    public function test_bp_has_groups_single_group_with_slug() {
     110        $g1 = $this->factory->group->create( array(
     111            'name' => 'Test Group',
     112            'slug' => 'test-group',
     113            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 100 ),
     114        ) );
     115
     116        global $groups_template;
     117        bp_has_groups( array(
     118            'type' => 'single-group',
     119            'slug' => 'test-group',
     120        ) );
     121
     122        $ids = wp_parse_id_list( wp_list_pluck( $groups_template->groups, 'id' ) );
     123        $this->assertEquals( array( $g1 ), $ids );
     124
     125        $this->assertEquals( 1, $groups_template->group_count );
    99126    }
    100127
Note: See TracChangeset for help on using the changeset viewer.