Changeset 7050
- Timestamp:
- 05/09/2013 02:22:04 PM (11 years ago)
- Location:
- trunk/tests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/includes/factory.php
r7047 r7050 76 76 groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() ); 77 77 78 return $ this->get_object_by_id( $group_id );78 return $group_id; 79 79 } 80 80 -
trunk/tests/testcases/groups/class-bp-groups-group.php
r7038 r7050 29 29 $g1 = $this->factory->group->create(); 30 30 $g2 = $this->factory->group->create(); 31 groups_update_groupmeta( $g1 ->id, 'foo', 'bar' );31 groups_update_groupmeta( $g1, 'foo', 'bar' ); 32 32 33 33 $groups = BP_Groups_Group::get( array( 34 34 'exclude' => array( 35 $g1 ->id,35 $g1, 36 36 'foobar', 37 37 ), 38 38 ) ); 39 39 $ids = wp_list_pluck( $groups['groups'], 'id' ); 40 $this->assertEquals( $ids, array( $g2 ->id) );40 $this->assertEquals( $ids, array( $g2 ) ); 41 41 } 42 42 … … 44 44 $g1 = $this->factory->group->create(); 45 45 $g2 = $this->factory->group->create(); 46 groups_update_groupmeta( $g1 ->id, 'foo', 'bar' );46 groups_update_groupmeta( $g1, 'foo', 'bar' ); 47 47 48 48 $groups = BP_Groups_Group::get( array( 49 49 'include' => array( 50 $g1 ->id,50 $g1, 51 51 'foobar', 52 52 ), 53 53 ) ); 54 54 $ids = wp_list_pluck( $groups['groups'], 'id' ); 55 $this->assertEquals( $ids, array( $g1 ->id) );55 $this->assertEquals( $ids, array( $g1 ) ); 56 56 } 57 57 … … 59 59 $g1 = $this->factory->group->create(); 60 60 $g2 = $this->factory->group->create(); 61 groups_update_groupmeta( $g1 ->id, 'foo', 'bar' );61 groups_update_groupmeta( $g1, 'foo', 'bar' ); 62 62 63 63 $groups = BP_Groups_Group::get( array( … … 70 70 ) ); 71 71 $ids = wp_list_pluck( $groups['groups'], 'id' ); 72 $this->assertEquals( $ids, array( $g1 ->id) );72 $this->assertEquals( $ids, array( $g1 ) ); 73 73 } 74 74 … … 76 76 $g1 = $this->factory->group->create(); 77 77 $g2 = $this->factory->group->create(); 78 groups_update_groupmeta( $g1 ->id, 'foo', 'bar' );78 groups_update_groupmeta( $g1, 'foo', 'bar' ); 79 79 80 80 $groups = BP_Groups_Group::get( array( … … 82 82 ) ); 83 83 $ids = wp_list_pluck( $groups['groups'], 'id' ); 84 $this->assertEquals( $ids, array( $g1 ->id, $g2->id, ) );84 $this->assertEquals( $ids, array( $g1, $g2, ) ); 85 85 } 86 86 … … 97 97 98 98 $found = wp_list_pluck( $groups['groups'], 'id' ); 99 $this->assertEquals( array( $g1 ->id), $found );99 $this->assertEquals( array( $g1 ), $found ); 100 100 } 101 101 … … 112 112 113 113 $found = wp_list_pluck( $groups['groups'], 'id' ); 114 $this->assertEquals( array( $g1 ->id), $found );114 $this->assertEquals( array( $g1 ), $found ); 115 115 } 116 116 … … 127 127 128 128 $found = wp_list_pluck( $groups['groups'], 'id' ); 129 $this->assertEquals( array( $g1 ->id), $found );129 $this->assertEquals( array( $g1 ), $found ); 130 130 } 131 131 … … 143 143 $found = wp_list_pluck( $groups['groups'], 'id' ); 144 144 145 // @todo 146 $this->assertEquals( array( $g1->id ), $found ); 145 $this->assertEquals( array( $g1 ), $found ); 147 146 } 148 147 … … 154 153 $g2 = $this->factory->group->create(); 155 154 $u = $this->factory->user->create(); 156 self::add_user_to_group( $u, $g1 ->id);155 self::add_user_to_group( $u, $g1 ); 157 156 158 157 $groups = BP_Groups_Group::filter_user_groups( 'Cool', $u ); 159 158 160 159 $found = wp_list_pluck( $groups['groups'], 'group_id' ); 161 $this->assertEquals( array( $g1 ->id), $found );160 $this->assertEquals( array( $g1 ), $found ); 162 161 } 163 162 … … 170 169 171 170 $u = $this->factory->user->create(); 172 self::add_user_to_group( $u, $g1 ->id);173 self::add_user_to_group( $u, $g2 ->id);171 self::add_user_to_group( $u, $g1 ); 172 self::add_user_to_group( $u, $g2 ); 174 173 175 174 $groups = BP_Groups_Group::filter_user_groups( '_cool_', $u ); 176 175 177 176 $found = wp_list_pluck( $groups['groups'], 'group_id' ); 178 $this->assertEquals( array( $g1 ->id), $found );177 $this->assertEquals( array( $g1 ), $found ); 179 178 } 180 179 … … 187 186 188 187 $u = $this->factory->user->create(); 189 self::add_user_to_group( $u, $g1 ->id);190 self::add_user_to_group( $u, $g2 ->id);188 self::add_user_to_group( $u, $g1 ); 189 self::add_user_to_group( $u, $g2 ); 191 190 192 191 $groups = BP_Groups_Group::filter_user_groups( '100%', $u ); 193 192 194 193 $found = wp_list_pluck( $groups['groups'], 'group_id' ); 195 $this->assertEquals( array( $g1 ->id), $found );194 $this->assertEquals( array( $g1 ), $found ); 196 195 } 197 196 … … 204 203 205 204 $u = $this->factory->user->create(); 206 self::add_user_to_group( $u, $g1 ->id);207 self::add_user_to_group( $u, $g2 ->id);205 self::add_user_to_group( $u, $g1 ); 206 self::add_user_to_group( $u, $g2 ); 208 207 209 208 $groups = BP_Groups_Group::filter_user_groups( "'tis ", $u ); … … 225 224 226 225 $found = wp_list_pluck( $groups['groups'], 'group_id' ); 227 $this->assertEquals( array( $g1 ->id), $found );226 $this->assertEquals( array( $g1 ), $found ); 228 227 } 229 228 … … 238 237 239 238 $found = wp_list_pluck( $groups['groups'], 'group_id' ); 240 $this->assertEquals( array( $g1 ->id), $found );239 $this->assertEquals( array( $g1 ), $found ); 241 240 } 242 241 … … 251 250 252 251 $found = wp_list_pluck( $groups['groups'], 'group_id' ); 253 $this->assertEquals( array( $g1 ->id), $found );252 $this->assertEquals( array( $g1 ), $found ); 254 253 } 255 254 … … 265 264 $found = wp_list_pluck( $groups['groups'], 'group_id' ); 266 265 267 $this->assertEquals( array( $g1 ->id), $found );266 $this->assertEquals( array( $g1 ), $found ); 268 267 } 269 268 … … 278 277 ) ); 279 278 280 $groups = BP_Groups_Group::get_by_letter( 'A', null, null, true, array( $g1 ->id, 'stringthatshouldberemoved' ) );281 282 $found = wp_list_pluck( $groups['groups'], 'id' ); 283 284 $this->assertEquals( array( $g2 ->id), $found );279 $groups = BP_Groups_Group::get_by_letter( 'A', null, null, true, array( $g1, 'stringthatshouldberemoved' ) ); 280 281 $found = wp_list_pluck( $groups['groups'], 'id' ); 282 283 $this->assertEquals( array( $g2 ), $found ); 285 284 286 285 } … … 310 309 311 310 // There are only two groups, so excluding one should give us the other 312 $groups = BP_Groups_Group::get_random( null, null, 0, false, true, array( $g1 ->id, 'ignore this' ) );313 314 $found = wp_list_pluck( $groups['groups'], 'id' ); 315 316 $this->assertEquals( array( $g2 ->id), $found );311 $groups = BP_Groups_Group::get_random( null, null, 0, false, true, array( $g1, 'ignore this' ) ); 312 313 $found = wp_list_pluck( $groups['groups'], 'id' ); 314 315 $this->assertEquals( array( $g2 ), $found ); 317 316 } 318 317 … … 330 329 $found = wp_list_pluck( $groups['groups'], 'id' ); 331 330 332 $this->assertEquals( array( $g1 ->id), $found );331 $this->assertEquals( array( $g1 ), $found ); 333 332 } 334 333 } -
trunk/tests/testcases/groups/class-bp-groups-member.php
r7015 r7050 48 48 49 49 $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 ); 52 52 53 53 $groups = BP_Groups_Member::get_recently_joined( $u, false, false, 'Rite' ); 54 54 55 55 $ids = wp_list_pluck( $groups['groups'], 'id' ); 56 $this->assertEquals( $ids, array( $g2 ->id) );56 $this->assertEquals( $ids, array( $g2 ) ); 57 57 } 58 58 … … 66 66 67 67 $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 ); 70 70 71 $m1 = new BP_Groups_Member( $u, $g1 ->id);71 $m1 = new BP_Groups_Member( $u, $g1 ); 72 72 $m1->promote( 'admin' ); 73 $m2 = new BP_Groups_Member( $u, $g2 ->id);73 $m2 = new BP_Groups_Member( $u, $g2 ); 74 74 $m2->promote( 'admin' ); 75 75 … … 77 77 78 78 $ids = wp_list_pluck( $groups['groups'], 'id' ); 79 $this->assertEquals( $ids, array( $g2 ->id) );79 $this->assertEquals( $ids, array( $g2 ) ); 80 80 } 81 81 … … 89 89 90 90 $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 ); 93 93 94 $m1 = new BP_Groups_Member( $u, $g1 ->id);94 $m1 = new BP_Groups_Member( $u, $g1 ); 95 95 $m1->promote( 'mod' ); 96 $m2 = new BP_Groups_Member( $u, $g2 ->id);96 $m2 = new BP_Groups_Member( $u, $g2 ); 97 97 $m2->promote( 'mod' ); 98 98 … … 100 100 101 101 $ids = wp_list_pluck( $groups['groups'], 'id' ); 102 $this->assertEquals( $ids, array( $g2 ->id) );102 $this->assertEquals( $ids, array( $g2 ) ); 103 103 } 104 104 … … 113 113 $u1 = $this->factory->user->create(); 114 114 $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 ); 119 119 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 ) ); 121 121 122 122 $ids = wp_list_pluck( $groups['groups'], 'id' ); 123 $this->assertEquals( $ids, array( $g2 ->id) );123 $this->assertEquals( $ids, array( $g2 ) ); 124 124 } 125 125 … … 129 129 $u1 = $this->create_user(); 130 130 $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 ); 133 133 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 ) ); 135 135 136 136 $mm = (array) $members['members']; -
trunk/tests/testcases/groups/template.php
r6950 r7050 15 15 $g1 = $this->factory->group->create(); 16 16 $g2 = $this->factory->group->create(); 17 groups_update_groupmeta( $g1 ->id, 'foo', 'bar' );17 groups_update_groupmeta( $g1, 'foo', 'bar' ); 18 18 19 19 global $groups_template; … … 28 28 29 29 $ids = wp_list_pluck( $groups_template->groups, 'id' ); 30 $this->assertEquals( $ids, array( $g1 ->id, ) );30 $this->assertEquals( $ids, array( $g1, ) ); 31 31 } 32 32 }
Note: See TracChangeset
for help on using the changeset viewer.