Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/13/2016 05:35:42 AM (8 years ago)
Author:
boonebgorges
Message:

Groups: Remove 'populate_extras' flag from BP_Groups_Group.

populate_extras was originally designed to reduce the number of
additional queries performed when setting up a group, by making those
queries optional in cases where the additional data was not needed.
Now, all of these properties are adequately cached, and lazy-loaded
so that they're only fetched when requested.

See #5451.

File:
1 edited

Legend:

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

    r11087 r11089  
    13001300
    13011301    /**
     1302     * @ticket BP5451
     1303     */
     1304    public function test_is_member_property() {
     1305        $users = $this->factory->user->create_many( 2 );
     1306
     1307        $g = $this->factory->group->create( array(
     1308            'creator_id' => $users[0],
     1309        ) );
     1310
     1311        wp_set_current_user( $users[1] );
     1312
     1313        $group_a = new BP_Groups_Group( $g );
     1314        $this->assertFalse( $group_a->is_member );
     1315
     1316        $this->add_user_to_group( $users[1], $g );
     1317        $group_b = new BP_Groups_Group( $g );
     1318        $this->assertFalse( $group_b->is_member );
     1319    }
     1320
     1321    /**
     1322     * @ticket BP5451
     1323     */
     1324    public function test_is_invited_property() {
     1325        $users = $this->factory->user->create_many( 2 );
     1326
     1327        $g = $this->factory->group->create( array(
     1328            'creator_id' => $users[0],
     1329        ) );
     1330
     1331        wp_set_current_user( $users[1] );
     1332
     1333        $group_a = new BP_Groups_Group( $g );
     1334        $this->assertFalse( $group_a->is_invited );
     1335
     1336        $this->add_user_to_group( $users[1], $g, array(
     1337            'invite_sent' => 1,
     1338            'inviter_id' => $users[0],
     1339            'is_confirmed' => 0,
     1340        ) );
     1341        $group_b = new BP_Groups_Group( $g );
     1342        $this->assertFalse( $group_b->is_invited );
     1343    }
     1344
     1345    /**
     1346     * @ticket BP5451
     1347     */
     1348    public function test_is_pending_property() {
     1349        $users = $this->factory->user->create_many( 2 );
     1350
     1351        $g = $this->factory->group->create( array(
     1352            'creator_id' => $users[0],
     1353        ) );
     1354
     1355        wp_set_current_user( $users[1] );
     1356
     1357        $group_a = new BP_Groups_Group( $g );
     1358        $this->assertFalse( $group_a->is_pending );
     1359
     1360        $this->add_user_to_group( $users[1], $g, array(
     1361            'is_confirmed' => 0,
     1362            'invite_sent' => 0,
     1363            'inviter_id' => 0,
     1364        ) );
     1365        $group_b = new BP_Groups_Group( $g );
     1366        $this->assertFalse( $group_b->is_pending );
     1367    }
     1368
     1369
     1370    /**
    13021371     * @group group_types
    13031372     */
Note: See TracChangeset for help on using the changeset viewer.