Skip to:
Content

BuddyPress.org

Ticket #5584: 5584-unit-tests.diff

File 5584-unit-tests.diff, 1.0 KB (added by Mamaduka, 7 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..a134a31 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         */
     533        public function test_get_groups_with_with_no_member_total() {
     534                $user_id = get_current_user_id();
     535
     536                $g1 = $this->factory->group->create( array(
     537                        'name' => 'A Group'
     538                ) );
     539                $g2 = $this->factory->group->create( array(
     540                        'name' => 'B Group'
     541                ) );
     542
     543                // Delete default user.
     544                BP_Groups_Member::delete( $user_id, $g1 );
     545                BP_Groups_Member::delete( $user_id, $g2 );
     546
     547                $groups = BP_Groups_Group::get();
     548
     549                $this->assertEquals( 2, count( $groups['groups'] ) );
     550                $this->assertEquals( 2, $groups['total'] );
     551        }
     552
    530553        /** convert_type_to_order_orderby() **********************************/
    531554
    532555        /**