Changeset 7182 for trunk/tests/testcases/groups/functions.php
- Timestamp:
- 06/07/2013 02:06:51 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/groups/functions.php
r7179 r7182 58 58 /** 59 59 * @group total_group_count 60 * @group BP_Groups_Member 61 * @group unban 62 */ 63 public function test_total_group_count_BP_Groups_Member_unban() { 60 * @group groups_unban_member 61 */ 62 public function test_total_group_count_groups_unban_member() { 64 63 $u1 = $this->create_user(); 65 64 $u2 = $this->create_user(); … … 113 112 } 114 113 114 /** 115 * @group total_group_count 116 * @group groups_remove_member 117 */ 115 118 public function test_total_group_count_groups_remove_member() { 116 119 $u1 = $this->create_user(); … … 129 132 $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) ); 130 133 } 134 135 /** 136 * @group total_member_count 137 * @group groups_join_group 138 */ 139 public function test_total_member_count_groups_join_group() { 140 $u1 = $this->create_user(); 141 $u2 = $this->create_user(); 142 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 143 144 groups_join_group( $g, $u2 ); 145 $this->assertEquals( 2, groups_get_groupmeta( $g, 'total_member_count' ) ); 146 } 147 148 /** 149 * @group total_member_count 150 * @group groups_leave_group 151 */ 152 public function test_total_member_count_groups_leave_group() { 153 $u1 = $this->create_user(); 154 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 155 groups_join_group( $g1, $u2 ); 156 157 groups_leave_group( $g1, $u2 ); 158 $this->assertEquals( 1, groups_get_groupmeta( $g1, 'total_member_count' ) ); 159 } 160 161 /** 162 * @group total_member_count 163 * @group groups_ban_member 164 */ 165 public function test_total_member_count_groups_ban_member() { 166 $u1 = $this->create_user(); 167 $u2 = $this->create_user(); 168 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 169 groups_join_group( $g1, $u2 ); 170 171 // Fool the admin check 172 $this->set_current_user( $u1 ); 173 buddypress()->is_item_admin = true; 174 175 groups_ban_member( $u2, $g1 ); 176 177 $this->assertEquals( 1, groups_get_groupmeta( $g1, 'total_member_count' ) ); 178 } 179 180 /** 181 * @group total_member_count 182 * @group groups_unban_member 183 */ 184 public function test_total_member_count_groups_unban_member() { 185 $u1 = $this->create_user(); 186 $u2 = $this->create_user(); 187 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 188 groups_join_group( $g1, $u2 ); 189 190 // Fool the admin check 191 $this->set_current_user( $u1 ); 192 buddypress()->is_item_admin = true; 193 194 groups_ban_member( $u2, $g1 ); 195 196 groups_unban_member( $u2, $g1 ); 197 198 $this->assertEquals( 2, groups_get_groupmeta( $g1, 'total_member_count' ) ); 199 } 200 201 /** 202 * @group total_member_count 203 * @group groups_accept_invite 204 */ 205 public function test_total_member_count_groups_accept_invite() { 206 $u1 = $this->create_user(); 207 $u2 = $this->create_user(); 208 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 209 groups_invite_user( array( 210 'user_id' => $u1, 211 'group_id' => $g, 212 'inviter_id' => $u2, 213 ) ); 214 215 groups_accept_invite( $u2, $g ); 216 217 $this->assertEquals( 2, groups_get_groupmeta( $g, 'total_member_count' ) ); 218 } 219 220 /** 221 * @group total_member_count 222 * @group groups_accept_membership_request 223 */ 224 public function test_total_member_count_groups_accept_membership_request() { 225 $u1 = $this->create_user(); 226 $u2 = $this->create_user(); 227 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 228 groups_send_membership_request( $u2, $g ); 229 230 groups_accept_membership_request( 0, $u2, $g ); 231 232 $this->assertEquals( 2, groups_get_groupmeta( $g, 'total_member_count' ) ); 233 } 234 235 /** 236 * @group total_member_count 237 * @group groups_remove_member 238 */ 239 public function test_total_member_count_groups_remove_member() { 240 $u1 = $this->create_user(); 241 $u2 = $this->create_user(); 242 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 243 groups_join_group( $g1, $u2 ); 244 245 // Fool the admin check 246 $this->set_current_user( $u1 ); 247 buddypress()->is_item_admin = true; 248 249 groups_remove_member( $u2, $g1 ); 250 251 $this->assertEquals( 1, groups_get_groupmeta( $g1, 'total_member_count' ) ); 252 } 253 254 /** 255 * @group total_member_count 256 * @group groups_create_group 257 */ 258 public function test_total_member_count_groups_create_group() { 259 $u1 = $this->create_user(); 260 $g = groups_create_group( array( 261 'creator_id' => $u1, 262 'name' => 'Boone Is Handsome', 263 'description' => 'Yes', 264 'slug' => 'boone-is-handsome', 265 'status' => 'public', 266 'enable_forum' => 0, 267 'date_created' => bp_core_current_time(), 268 ) ); 269 270 $this->assertEquals( 1, groups_get_groupmeta( $g, 'total_member_count' ) ); 271 } 131 272 }
Note: See TracChangeset
for help on using the changeset viewer.