Skip to:
Content

BuddyPress.org

Ticket #5584: 5584-unit-tests.2.diff

File 5584-unit-tests.2.diff, 1.2 KB (added by boonebgorges, 10 years ago)
  • tests/phpunit/testcases/groups/class-bp-groups-group.php

    diff --git tests/phpunit/testcases/groups/class-bp-groups-group.php tests/phpunit/testcases/groups/class-bp-groups-group.php
    index eda655f..f69d0b0 100644
    class BP_Tests_BP_Groups_Group_TestCases extends BP_UnitTestCase { 
    527527                $this->assertEquals( '12', count( $groups['groups'] ) );
    528528        }
    529529
     530        /**
     531         * @group get
     532         * @ticket BP5584
     533         */
     534        public function test_get_should_return_proper_pagination_when_group_has_no_members() {
     535                $u = $this->factory->user->create();
     536
     537                $g1 = $this->factory->group->create( array(
     538                        'name' => 'A Group',
     539                        'creator_id' => $u,
     540                ) );
     541                $g2 = $this->factory->group->create( array(
     542                        'name' => 'B Group',
     543                        'creator_id' => $u,
     544                ) );
     545
     546                // Delete default user.
     547                BP_Groups_Member::delete( $u, $g1 );
     548                BP_Groups_Member::delete( $u, $g2 );
     549
     550                $g1_o = groups_get_group( array( 'group_id' => $g1 ) );
     551
     552                $groups = BP_Groups_Group::get();
     553
     554                $this->assertEquals( 2, count( $groups['groups'] ) );
     555                $this->assertEquals( 2, $groups['total'] );
     556        }
     557
    530558        /** convert_type_to_order_orderby() **********************************/
    531559
    532560        /**