Changeset 7050 for trunk/tests/testcases/groups/class-bp-groups-group.php
- Timestamp:
- 05/09/2013 02:22:04 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.