Changeset 8314 for branches/2.0/tests/testcases/members/functions.php
- Timestamp:
- 04/24/2014 12:22:06 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/tests/testcases/members/functions.php
r8027 r8314 280 280 $this->assertSame( $expected, bp_core_get_user_displaynames( array( $u1, $u2, ) ) ); 281 281 } 282 283 /** 284 * @group bp_members_migrate_signups 285 */ 286 public function test_bp_members_migrate_signups_standard() { 287 $u = $this->create_user(); 288 $u_obj = new WP_User( $u ); 289 290 // Fake an old-style registration 291 $key = wp_hash( $u_obj->ID ); 292 update_user_meta( $u, 'activation_key', $key ); 293 294 global $wpdb; 295 $wpdb->update( 296 $wpdb->users, 297 array( 'user_status' => '2', ), 298 array( 'ID' => $u, ), 299 array( '%d', ), 300 array( '%d', ) 301 ); 302 clean_user_cache( $u ); 303 304 bp_members_migrate_signups(); 305 306 $found = BP_Signup::get(); 307 308 // Use email address as a sanity check 309 $found_email = isset( $found['signups'][0]->user_email ) ? $found['signups'][0]->user_email : ''; 310 $this->assertSame( $u_obj->user_email, $found_email ); 311 312 // Check that activation keys match 313 $found_key = isset( $found['signups'][0]->activation_key ) ? $found['signups'][0]->activation_key : ''; 314 $this->assertSame( $key, $found_key ); 315 } 316 317 /** 318 * @group bp_members_migrate_signups 319 */ 320 public function test_bp_members_migrate_signups_activation_key_but_user_status_0() { 321 $u = $this->create_user(); 322 $u_obj = new WP_User( $u ); 323 324 // Fake an old-style registration 325 $key = wp_hash( $u_obj->ID ); 326 update_user_meta( $u, 'activation_key', $key ); 327 328 // ...but ensure that user_status is 0. This mimics the 329 // behavior of certain plugins that disrupt the BP registration 330 // flow 331 global $wpdb; 332 $wpdb->update( 333 $wpdb->users, 334 array( 'user_status' => '0', ), 335 array( 'ID' => $u, ), 336 array( '%d', ), 337 array( '%d', ) 338 ); 339 clean_user_cache( $u ); 340 341 bp_members_migrate_signups(); 342 343 // No migrations should have taken place 344 $found = BP_Signup::get(); 345 $this->assertEmpty( $found['total'] ); 346 } 347 348 /** 349 * @group bp_members_migrate_signups 350 */ 351 public function test_bp_members_migrate_signups_no_activation_key_but_user_status_2() { 352 $u = $this->create_user(); 353 $u_obj = new WP_User( $u ); 354 355 // Fake an old-style registration but without an activation key 356 global $wpdb; 357 $wpdb->update( 358 $wpdb->users, 359 array( 'user_status' => '2', ), 360 array( 'ID' => $u, ), 361 array( '%d', ), 362 array( '%d', ) 363 ); 364 clean_user_cache( $u ); 365 366 bp_members_migrate_signups(); 367 368 // Use email address as a sanity check 369 $found = BP_Signup::get(); 370 $found_email = isset( $found['signups'][0]->user_email ) ? $found['signups'][0]->user_email : ''; 371 $this->assertSame( $u_obj->user_email, $found_email ); 372 } 282 373 }
Note: See TracChangeset
for help on using the changeset viewer.