Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/09/2013 02:22:04 PM (11 years ago)
Author:
boonebgorges
Message:

In test suite, factory->group->create() should return an id, not an object

For better parity with other factories

File:
1 edited

Legend:

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

    r7015 r7050  
    4848
    4949        $u = $this->factory->user->create();
    50         self::add_user_to_group( $u, $g1->id );
    51         self::add_user_to_group( $u, $g2->id );
     50        self::add_user_to_group( $u, $g1 );
     51        self::add_user_to_group( $u, $g2 );
    5252
    5353        $groups = BP_Groups_Member::get_recently_joined( $u, false, false, 'Rite' );
    5454
    5555        $ids = wp_list_pluck( $groups['groups'], 'id' );
    56         $this->assertEquals( $ids, array( $g2->id ) );
     56        $this->assertEquals( $ids, array( $g2 ) );
    5757    }
    5858
     
    6666
    6767        $u = $this->factory->user->create();
    68         self::add_user_to_group( $u, $g1->id );
    69         self::add_user_to_group( $u, $g2->id );
     68        self::add_user_to_group( $u, $g1 );
     69        self::add_user_to_group( $u, $g2 );
    7070
    71         $m1 = new BP_Groups_Member( $u, $g1->id );
     71        $m1 = new BP_Groups_Member( $u, $g1 );
    7272        $m1->promote( 'admin' );
    73         $m2 = new BP_Groups_Member( $u, $g2->id );
     73        $m2 = new BP_Groups_Member( $u, $g2 );
    7474        $m2->promote( 'admin' );
    7575
     
    7777
    7878        $ids = wp_list_pluck( $groups['groups'], 'id' );
    79         $this->assertEquals( $ids, array( $g2->id ) );
     79        $this->assertEquals( $ids, array( $g2 ) );
    8080    }
    8181
     
    8989
    9090        $u = $this->factory->user->create();
    91         self::add_user_to_group( $u, $g1->id );
    92         self::add_user_to_group( $u, $g2->id );
     91        self::add_user_to_group( $u, $g1 );
     92        self::add_user_to_group( $u, $g2 );
    9393
    94         $m1 = new BP_Groups_Member( $u, $g1->id );
     94        $m1 = new BP_Groups_Member( $u, $g1 );
    9595        $m1->promote( 'mod' );
    96         $m2 = new BP_Groups_Member( $u, $g2->id );
     96        $m2 = new BP_Groups_Member( $u, $g2 );
    9797        $m2->promote( 'mod' );
    9898
     
    100100
    101101        $ids = wp_list_pluck( $groups['groups'], 'id' );
    102         $this->assertEquals( $ids, array( $g2->id ) );
     102        $this->assertEquals( $ids, array( $g2 ) );
    103103    }
    104104
     
    113113        $u1 = $this->factory->user->create();
    114114        $u2 = $this->factory->user->create();
    115         self::add_user_to_group( $u1, $g1->id );
    116         self::add_user_to_group( $u1, $g2->id );
    117         self::invite_user_to_group( $u2, $g1->id, $u1 );
    118         self::invite_user_to_group( $u2, $g2->id, $u1 );
     115        self::add_user_to_group( $u1, $g1 );
     116        self::add_user_to_group( $u1, $g2 );
     117        self::invite_user_to_group( $u2, $g1, $u1 );
     118        self::invite_user_to_group( $u2, $g2, $u1 );
    119119
    120         $groups = BP_Groups_Member::get_invites( $u2, false, false, array( 'awesome', $g1->id ) );
     120        $groups = BP_Groups_Member::get_invites( $u2, false, false, array( 'awesome', $g1 ) );
    121121
    122122        $ids = wp_list_pluck( $groups['groups'], 'id' );
    123         $this->assertEquals( $ids, array( $g2->id ) );
     123        $this->assertEquals( $ids, array( $g2 ) );
    124124    }
    125125
     
    129129        $u1 = $this->create_user();
    130130        $u2 = $this->create_user();
    131         self::add_user_to_group( $u1, $g1->id );
    132         self::add_user_to_group( $u2, $g1->id );
     131        self::add_user_to_group( $u1, $g1 );
     132        self::add_user_to_group( $u2, $g1 );
    133133
    134         $members = BP_Groups_Member::get_all_for_group( $g1->id, false, false, true, true, array( $u1 ) );
     134        $members = BP_Groups_Member::get_all_for_group( $g1, false, false, true, true, array( $u1 ) );
    135135
    136136        $mm = (array) $members['members'];
Note: See TracChangeset for help on using the changeset viewer.