Skip to:
Content

BuddyPress.org

Ticket #7302: 7302.2.patch

File 7302.2.patch, 2.2 KB (added by dcavins, 9 years ago)

Fix spacing.

  • src/bp-groups/bp-groups-functions.php

    diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php
    index 870e53f..006bf6f 100644
    function bp_groups_has_directory() { 
    4343 * @return BP_Groups_Group $group The group object.
    4444 */
    4545function groups_get_group( $group_id ) {
    46         // Backward compatibilty.
    47         if ( is_array( $group_id ) && isset( $group_id['group_id'] ) ) {
    48                 $group_id = $group_id['group_id'];
     46        /*
     47         * Backward compatibilty.
     48         * Old-style arguments take the form of an array or a query string.
     49         */
     50        if ( ! is_numeric( $group_id ) ) {
     51                $r = wp_parse_args( $group_id, array(
     52                        'group_id'        => false,
     53                        'load_users'      => false,
     54                        'populate_extras' => false,
     55                ) );
     56
     57                $group_id = $r['group_id'];
    4958        }
    5059
    5160        $group = new BP_Groups_Group( $group_id );
  • tests/phpunit/testcases/groups/functions.php

    diff --git tests/phpunit/testcases/groups/functions.php tests/phpunit/testcases/groups/functions.php
    index 7fc01de..4a4c8ba 100644
    Bar!'; 
    667667                $child = groups_get_group( array( 'group_id' => $g3 ) );
    668668                $this->assertEquals( $g1, $child->parent_id );
    669669        }
     670
     671        /**
     672         * @group groups_get_group
     673         * @ticket BP7302
     674         */
     675        public function test_groups_get_group_accept_integer() {
     676                $g1 = $this->factory->group->create();
     677                $group = groups_get_group( $g1 );
     678
     679                $this->assertEquals( $g1, $group->id );
     680        }
     681
     682        /**
     683         * @group groups_get_group
     684         * @ticket BP7302
     685         */
     686        public function test_groups_get_group_accept_numeric() {
     687                $g1 = $this->factory->group->create();
     688                $group = groups_get_group( (string) $g1 );
     689
     690                $this->assertEquals( $g1, $group->id );
     691        }
     692
     693        /**
     694         * @group groups_get_group
     695         * @ticket BP7302
     696         */
     697        public function test_groups_get_group_accept_array() {
     698                $g1 = $this->factory->group->create();
     699                $group = groups_get_group( array( 'group_id' => $g1 ) );
     700
     701                $this->assertEquals( $g1, $group->id );
     702        }
     703
     704        /**
     705         * @group groups_get_group
     706         * @ticket BP7302
     707         */
     708        public function test_groups_get_group_accept_query_string() {
     709                $g1 = $this->factory->group->create();
     710                $group = groups_get_group( 'group_id=' . $g1 );
     711
     712                $this->assertEquals( $g1, $group->id );
     713        }
    670714}