Changeset 9139
- Timestamp:
- 11/14/2014 02:01:18 PM (10 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory.php
r9120 r9139 6 6 parent::__construct(); 7 7 8 $this->user = new BP_UnitTest_Factory_For_User( $this ); 8 9 $this->activity = new BP_UnitTest_Factory_For_Activity( $this ); 9 10 $this->group = new BP_UnitTest_Factory_For_Group( $this ); … … 16 17 } 17 18 19 class BP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_User { 20 /** 21 * When creating a new user, it's almost always necessary to have the 22 * last_activity usermeta set right away, so that the user shows up in 23 * directory queries. This is a shorthand wrapper for the user factory 24 * create() method. 25 * 26 * Also set a display name 27 */ 28 public function create_object( $args ) { 29 $r = wp_parse_args( $args, array( 30 'role' => 'subscriber', 31 'last_activity' => date( 'Y-m-d H:i:s', strtotime( bp_core_current_time() ) - 60*60*24*365 ), 32 ) ); 33 34 $last_activity = $r['last_activity']; 35 unset( $r['last_activity'] ); 36 37 $user_id = wp_insert_user( $r ); 38 39 bp_update_user_last_activity( $user_id, $last_activity ); 40 41 if ( bp_is_active( 'xprofile' ) ) { 42 $user = new WP_User( $user_id ); 43 xprofile_set_field_data( 1, $user_id, $user->display_name ); 44 } 45 46 return $user_id; 47 } 48 } 49 18 50 class BP_UnitTest_Factory_For_Activity extends WP_UnitTest_Factory_For_Thing { 19 51 -
trunk/tests/phpunit/includes/testcase.php
r9138 r9139 319 319 } 320 320 321 /**322 * When creating a new user, it's almost always necessary to have the323 * last_activity usermeta set right away, so that the user shows up in324 * directory queries. This is a shorthand wrapper for the user factory325 * create() method.326 *327 * Also set a display name328 */329 function create_user( $args = array() ) {330 $r = wp_parse_args( $args, array(331 'role' => 'subscriber',332 'last_activity' => date( 'Y-m-d H:i:s', strtotime( bp_core_current_time() ) - 60*60*24*365 ),333 ) );334 335 $last_activity = $r['last_activity'];336 unset( $r['last_activity'] );337 338 $user_id = $this->factory->user->create( $r );339 340 bp_update_user_last_activity( $user_id, $last_activity );341 342 if ( bp_is_active( 'xprofile' ) ) {343 $user = new WP_User( $user_id );344 xprofile_set_field_data( 1, $user_id, $user->display_name );345 }346 347 return $user_id;348 }349 350 321 public static function add_user_to_group( $user_id, $group_id, $args = array() ) { 351 322 $r = wp_parse_args( $args, array( -
trunk/tests/phpunit/testcases/activity/class.BP_Activity_Activity.php
r8958 r9139 10 10 11 11 $this->old_current_user = get_current_user_id(); 12 $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) ); 12 $this->set_current_user( $this->factory->user->create( array( 13 'role' => 'subscriber', 14 ) ) ); 13 15 } 14 16 … … 518 520 public function test_get_activity_comments_format() { 519 521 $now = time(); 520 $u1 = $this->create_user(); 521 $u2 = $this->create_user(); 522 523 $u1 = $this->factory->user->create(); 524 $u2 = $this->factory->user->create(); 522 525 523 526 $a1 = $this->factory->activity->create( array( -
trunk/tests/phpunit/testcases/activity/filters.php
r8958 r9139 10 10 */ 11 11 public function test_bp_activity_at_name_filter() { 12 $u1 = $this-> create_user( array(12 $u1 = $this->factory->user->create( array( 13 13 'user_login' => 'foobarbaz', 14 14 'user_nicename' => 'foobarbaz', 15 15 ) ); 16 16 17 $u2 = $this-> create_user( array(17 $u2 = $this->factory->user->create( array( 18 18 'user_login' => 'foo2', 19 19 'user_nicename' => 'foo2', -
trunk/tests/phpunit/testcases/activity/functions.php
r9052 r9139 453 453 add_filter( 'bp_is_username_compatibility_mode', '__return_false' ); 454 454 455 $u = $this-> create_user( array(455 $u = $this->factory->user->create( array( 456 456 'user_login' => 'foo bar baz', 457 457 'user_nicename' => 'foo-bar-baz', … … 469 469 add_filter( 'bp_is_username_compatibility_mode', '__return_true' ); 470 470 471 $u1 = $this-> create_user( array(471 $u1 = $this->factory->user->create( array( 472 472 'user_login' => 'foo bar baz', 473 473 'user_nicename' => 'foo-bar-baz', 474 474 ) ); 475 475 476 $u2 = $this-> create_user( array(476 $u2 = $this->factory->user->create( array( 477 477 'user_login' => 'foo.bar.baz', 478 478 'user_nicename' => 'foo-bar-baz', … … 491 491 add_filter( 'bp_is_username_compatibility_mode', '__return_false' ); 492 492 493 $u = $this-> create_user( array(493 $u = $this->factory->user->create( array( 494 494 'user_login' => 'foo bar baz', 495 495 'user_nicename' => 'foo-bar-baz', … … 508 508 509 509 // all spaces are hyphens 510 $u1 = $this-> create_user( array(510 $u1 = $this->factory->user->create( array( 511 511 'user_login' => 'foo bar baz', 512 512 'user_nicename' => 'foobarbaz', … … 514 514 515 515 // no spaces are hyphens 516 $u2 = $this-> create_user( array(516 $u2 = $this->factory->user->create( array( 517 517 'user_login' => 'foo-bar-baz-1', 518 518 'user_nicename' => 'foobarbaz-1', … … 520 520 521 521 // some spaces are hyphens 522 $u3 = $this-> create_user( array(522 $u3 = $this->factory->user->create( array( 523 523 'user_login' => 'foo bar-baz 2', 524 524 'user_nicename' => 'foobarbaz-2', 525 525 ) ); 526 526 527 $u4 = $this-> create_user( array(527 $u4 = $this->factory->user->create( array( 528 528 'user_login' => 'foo.bar.baz', 529 529 'user_nicename' => 'foo-bar-baz', … … 543 543 */ 544 544 public function test_bp_activity_format_activity_action_activity_update() { 545 $u = $this-> create_user();545 $u = $this->factory->user->create(); 546 546 $a = $this->factory->activity->create( array( 547 547 'component' => buddypress()->activity->id, … … 562 562 */ 563 563 public function test_bp_activity_format_activity_action_activity_comment() { 564 $u = $this-> create_user();564 $u = $this->factory->user->create(); 565 565 $a = $this->factory->activity->create( array( 566 566 'component' => buddypress()->activity->id, … … 747 747 */ 748 748 public function test_add_user_favorite_already_favorited() { 749 $u = $this-> create_user();749 $u = $this->factory->user->create(); 750 750 $a = $this->factory->activity->create(); 751 751 … … 762 762 */ 763 763 public function test_add_user_favorite_not_yet_favorited() { 764 $u = $this-> create_user();764 $u = $this->factory->user->create(); 765 765 $a = $this->factory->activity->create(); 766 766 $this->assertTrue( bp_activity_add_user_favorite( $a, $u ) ); … … 772 772 */ 773 773 public function test_remove_user_favorite_bad_activity_id() { 774 $u1 = $this-> create_user();775 $u2 = $this-> create_user();774 $u1 = $this->factory->user->create(); 775 $u2 = $this->factory->user->create(); 776 776 $a = $this->factory->activity->create(); 777 777 … … 805 805 */ 806 806 public function test_bp_activity_post_update_success() { 807 $u = $this-> create_user();807 $u = $this->factory->user->create(); 808 808 809 809 $a = bp_activity_post_update( array( -
trunk/tests/phpunit/testcases/activity/notifications.php
r9061 r9139 15 15 parent::setUp(); 16 16 $this->current_user = get_current_user_id(); 17 $this->u1 = $this-> create_user();18 $this->u2 = $this-> create_user();17 $this->u1 = $this->factory->user->create(); 18 $this->u2 = $this->factory->user->create(); 19 19 $this->set_current_user( $this->u1 ); 20 20 } -
trunk/tests/phpunit/testcases/activity/template.php
r9043 r9139 64 64 // save the current user and override logged-in user 65 65 $old_user = get_current_user_id(); 66 $u = $this-> create_user();66 $u = $this->factory->user->create(); 67 67 $this->set_current_user( $u ); 68 68 -
trunk/tests/phpunit/testcases/admin/functions.php
r8958 r9139 9 9 parent::setUp(); 10 10 $this->old_current_user = get_current_user_id(); 11 $this->set_current_user( $this-> create_user( array( 'role' => 'administrator' ) ) );11 $this->set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 12 12 13 13 if ( ! function_exists( 'bp_admin' ) ) { -
trunk/tests/phpunit/testcases/blogs/activity.php
r8958 r9139 12 12 13 13 $b = $this->factory->blog->create(); 14 $u = $this-> create_user();14 $u = $this->factory->user->create(); 15 15 $a = $this->factory->activity->create( array( 16 16 'component' => buddypress()->blogs->id, … … 36 36 } 37 37 38 $u = $this-> create_user();38 $u = $this->factory->user->create(); 39 39 $p = $this->factory->post->create( array( 40 40 'post_author' => $u, … … 70 70 } 71 71 72 $u = $this-> create_user();72 $u = $this->factory->user->create(); 73 73 $p = $this->factory->post->create( array( 74 74 'post_author' => $u, … … 105 105 106 106 $b = $this->factory->blog->create(); 107 $u = $this-> create_user();107 $u = $this->factory->user->create(); 108 108 109 109 switch_to_blog( $b ); … … 145 145 146 146 $b = $this->factory->blog->create(); 147 $u = $this-> create_user();147 $u = $this->factory->user->create(); 148 148 149 149 switch_to_blog( $b ); … … 190 190 191 191 $b = $this->factory->blog->create(); 192 $u = $this-> create_user();192 $u = $this->factory->user->create(); 193 193 194 194 $recorded_blog = new BP_Blogs_Blog; … … 223 223 restore_current_blog(); 224 224 225 $u = $this-> create_user();225 $u = $this->factory->user->create(); 226 226 $a = $this->factory->activity->create( array( 227 227 'component' => buddypress()->blogs->id, … … 254 254 restore_current_blog(); 255 255 256 $u = $this-> create_user();256 $u = $this->factory->user->create(); 257 257 $a = $this->factory->activity->create( array( 258 258 'component' => buddypress()->blogs->id, -
trunk/tests/phpunit/testcases/blogs/cache.php
r8958 r9139 95 95 } 96 96 97 $u = $this-> create_user();97 $u = $this->factory->user->create(); 98 98 99 99 // Switch user so we have access to non-public blogs … … 189 189 } 190 190 191 $u = $this-> create_user();191 $u = $this->factory->user->create(); 192 192 193 193 // Switch user so we have access to non-public blogs -
trunk/tests/phpunit/testcases/blogs/class-bp-blogs-blog.php
r8958 r9139 21 21 $old_user = get_current_user_id(); 22 22 23 $u = $this-> create_user();23 $u = $this->factory->user->create(); 24 24 $this->set_current_user( $u ); 25 25 $b = $this->factory->blog->create( array( … … 47 47 $old_user = get_current_user_id(); 48 48 49 $u = $this-> create_user();49 $u = $this->factory->user->create(); 50 50 $this->set_current_user( $u ); 51 51 $b = $this->factory->blog->create( array( … … 77 77 $old_user = get_current_user_id(); 78 78 79 $u = $this-> create_user();79 $u = $this->factory->user->create(); 80 80 $this->set_current_user( $u ); 81 81 $b = $this->factory->blog->create( array( -
trunk/tests/phpunit/testcases/blogs/functions.php
r8958 r9139 401 401 // save the current user and override logged-in user 402 402 $old_user = get_current_user_id(); 403 $u = $this-> create_user();403 $u = $this->factory->user->create(); 404 404 $this->set_current_user( $u ); 405 405 $userdata = get_userdata( $u ); -
trunk/tests/phpunit/testcases/core/avatars.php
r9125 r9139 92 92 $this->clean_existing_avatars(); 93 93 94 $u = $this-> create_user();94 $u = $this->factory->user->create(); 95 95 $this->assertFalse( bp_get_user_has_avatar( $u ) ); 96 96 } … … 100 100 */ 101 101 public function test_bp_get_user_has_avatar_has_avatar_uploaded() { 102 $u = $this-> create_user();102 $u = $this->factory->user->create(); 103 103 104 104 // Fake it -
trunk/tests/phpunit/testcases/core/class-bp-button.php
r8958 r9139 22 22 */ 23 23 public function test_block_self_own_profile() { 24 $u = $this-> create_user();24 $u = $this->factory->user->create(); 25 25 $this->set_current_user( $u ); 26 26 … … 40 40 */ 41 41 public function test_block_self_others_profile() { 42 $u1 = $this-> create_user();42 $u1 = $this->factory->user->create(); 43 43 $this->set_current_user( $u1 ); 44 44 45 $u2 = $this-> create_user();45 $u2 = $this->factory->user->create(); 46 46 $this->go_to( bp_core_get_user_domain( $u2 ) ); 47 47 … … 60 60 public function test_block_self_inside_members_loop() { 61 61 $now = time(); 62 $u1 = $this-> create_user( array(62 $u1 = $this->factory->user->create( array( 63 63 'last_activity' => date( 'Y-m-d H:i:s', $now ), 64 64 ) ); 65 $u2 = $this-> create_user( array(65 $u2 = $this->factory->user->create( array( 66 66 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 67 67 ) ); … … 100 100 public function test_block_self_false_inside_members_loop() { 101 101 $now = time(); 102 $u1 = $this-> create_user( array(102 $u1 = $this->factory->user->create( array( 103 103 'last_activity' => date( 'Y-m-d H:i:s', $now ), 104 104 ) ); 105 $u2 = $this-> create_user( array(105 $u2 = $this->factory->user->create( array( 106 106 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 107 107 ) ); … … 140 140 public function test_block_self_inside_members_loop_on_my_profile_page() { 141 141 $now = time(); 142 $u1 = $this-> create_user( array(142 $u1 = $this->factory->user->create( array( 143 143 'last_activity' => date( 'Y-m-d H:i:s', $now ), 144 144 ) ); 145 $u2 = $this-> create_user( array(145 $u2 = $this->factory->user->create( array( 146 146 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 147 147 ) ); -
trunk/tests/phpunit/testcases/core/class-bp-core-user.php
r8958 r9139 20 20 */ 21 21 public function test_get_users_with_exclude_querystring() { 22 $u1 = $this-> create_user();23 $u2 = $this-> create_user();24 $u3 = $this-> create_user();22 $u1 = $this->factory->user->create(); 23 $u2 = $this->factory->user->create(); 24 $u3 = $this->factory->user->create(); 25 25 26 26 $exclude_qs = $u1 . ',junkstring,' . $u3; … … 36 36 */ 37 37 public function test_get_users_with_exclude_array() { 38 $u1 = $this-> create_user();39 $u2 = $this-> create_user();40 $u3 = $this-> create_user();38 $u1 = $this->factory->user->create(); 39 $u2 = $this->factory->user->create(); 40 $u3 = $this->factory->user->create(); 41 41 42 42 $exclude_array = array( … … 56 56 */ 57 57 public function test_get_users_with_include_querystring() { 58 $u1 = $this-> create_user( array(58 $u1 = $this->factory->user->create( array( 59 59 'last_activity' => gmdate( 'Y-m-d H:i:s' ), 60 60 ) ); 61 $u2 = $this-> create_user( array(61 $u2 = $this->factory->user->create( array( 62 62 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ), 63 63 ) ); 64 $u3 = $this-> create_user( array(64 $u3 = $this->factory->user->create( array( 65 65 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ), 66 66 ) ); … … 78 78 */ 79 79 public function test_get_users_with_include_array() { 80 $u1 = $this-> create_user( array(80 $u1 = $this->factory->user->create( array( 81 81 'last_activity' => gmdate( 'Y-m-d H:i:s' ), 82 82 ) ); 83 $u2 = $this-> create_user( array(83 $u2 = $this->factory->user->create( array( 84 84 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ), 85 85 ) ); 86 $u3 = $this-> create_user( array(86 $u3 = $this->factory->user->create( array( 87 87 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ), 88 88 ) ); … … 110 110 */ 111 111 public function test_type_alphabetical() { 112 $u1 = $this-> create_user( array(112 $u1 = $this->factory->user->create( array( 113 113 'display_name' => 'foo', 114 114 ) ); 115 $u2 = $this-> create_user( array(115 $u2 = $this->factory->user->create( array( 116 116 'display_name' => 'bar', 117 117 ) ); … … 129 129 */ 130 130 public function test_get_users_by_letter() { 131 $u1 = $this-> create_user( array(131 $u1 = $this->factory->user->create( array( 132 132 'display_name' => 'foo', 133 133 ) ); 134 $u2 = $this-> create_user( array(134 $u2 = $this->factory->user->create( array( 135 135 'display_name' => 'bar', 136 136 ) ); … … 146 146 */ 147 147 public function test_search_users() { 148 $u1 = $this-> create_user( array(148 $u1 = $this->factory->user->create( array( 149 149 'display_name' => 'foo', 150 150 ) ); 151 $u2 = $this-> create_user( array(151 $u2 = $this->factory->user->create( array( 152 152 'display_name' => 'bar', 153 153 ) ); … … 160 160 161 161 public function test_get_specific_users() { 162 $u1 = $this-> create_user();163 $u2 = $this-> create_user();164 $u3 = $this-> create_user();162 $u1 = $this->factory->user->create(); 163 $u2 = $this->factory->user->create(); 164 $u3 = $this->factory->user->create(); 165 165 166 166 $include_array = array( … … 180 180 */ 181 181 public function test_get_last_activity() { 182 $u = $this-> create_user();182 $u = $this->factory->user->create(); 183 183 $time = bp_core_current_time(); 184 184 … … 196 196 */ 197 197 public function test_get_last_activity_store_in_cache() { 198 $u = $this-> create_user();198 $u = $this->factory->user->create(); 199 199 $time = bp_core_current_time(); 200 200 … … 214 214 */ 215 215 public function test_get_last_activity_store_in_cache_multiple_users() { 216 $u1 = $this-> create_user();217 $u2 = $this-> create_user();216 $u1 = $this->factory->user->create(); 217 $u2 = $this->factory->user->create(); 218 218 $time = bp_core_current_time(); 219 219 … … 235 235 */ 236 236 public function test_get_last_activity_from_cache_single_user() { 237 $u = $this-> create_user();237 $u = $this->factory->user->create(); 238 238 $time = bp_core_current_time(); 239 239 … … 258 258 */ 259 259 public function test_get_last_activity_in_cache_multiple_users() { 260 $u1 = $this-> create_user();261 $u2 = $this-> create_user();260 $u1 = $this->factory->user->create(); 261 $u2 = $this->factory->user->create(); 262 262 $time = bp_core_current_time(); 263 263 … … 283 283 */ 284 284 public function test_update_last_activity() { 285 $u = $this-> create_user();285 $u = $this->factory->user->create(); 286 286 $time = bp_core_current_time(); 287 287 $time2 = '1968-12-25 01:23:45'; … … 302 302 */ 303 303 public function test_delete_last_activity() { 304 $u = $this-> create_user();304 $u = $this->factory->user->create(); 305 305 $time = bp_core_current_time(); 306 306 -
trunk/tests/phpunit/testcases/core/class-bp-user-query.php
r9051 r9139 24 24 */ 25 25 public function test_bp_user_query_friends() { 26 $u1 = $this-> create_user();27 $u2 = $this-> create_user();28 $u3 = $this-> create_user();26 $u1 = $this->factory->user->create(); 27 $u2 = $this->factory->user->create(); 28 $u3 = $this->factory->user->create(); 29 29 friends_add_friend( $u1, $u2, true ); 30 30 … … 42 42 */ 43 43 public function test_bp_user_query_friends_with_include() { 44 $u1 = $this-> create_user();45 $u2 = $this-> create_user();46 $u3 = $this-> create_user();47 $u4 = $this-> create_user();44 $u1 = $this->factory->user->create(); 45 $u2 = $this->factory->user->create(); 46 $u3 = $this->factory->user->create(); 47 $u4 = $this->factory->user->create(); 48 48 friends_add_friend( $u1, $u2, true ); 49 49 friends_add_friend( $u1, $u3, true ); … … 63 63 64 64 public function test_bp_user_query_friends_with_include_but_zero_friends() { 65 $u1 = $this-> create_user();66 $u2 = $this-> create_user();67 $u3 = $this-> create_user();68 $u4 = $this-> create_user();65 $u1 = $this->factory->user->create(); 66 $u2 = $this->factory->user->create(); 67 $u3 = $this->factory->user->create(); 68 $u4 = $this->factory->user->create(); 69 69 70 70 $q = new BP_User_Query( array( … … 82 82 83 83 public function test_bp_user_query_sort_by_popular() { 84 $u1 = $this-> create_user();85 $u2 = $this-> create_user();86 $u3 = $this-> create_user();87 $u4 = $this-> create_user();84 $u1 = $this->factory->user->create(); 85 $u2 = $this->factory->user->create(); 86 $u3 = $this->factory->user->create(); 87 $u4 = $this->factory->user->create(); 88 88 89 89 bp_update_user_meta( $u1, bp_get_user_meta_key( 'total_friend_count' ), '5' ); … … 108 108 public function test_bp_user_query_type_online() { 109 109 $now = time(); 110 $u1 = $this-> create_user( array(110 $u1 = $this->factory->user->create( array( 111 111 'last_activity' => date( 'Y-m-d H:i:s', $now ), 112 112 ) ); 113 $u2 = $this-> create_user( array(113 $u2 = $this->factory->user->create( array( 114 114 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*13 ), 115 115 ) ); 116 $u3 = $this-> create_user( array(116 $u3 = $this->factory->user->create( array( 117 117 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*16 ), 118 118 ) ); … … 132 132 public function test_bp_user_query_type_online_five_minute_interval() { 133 133 $now = time(); 134 $u1 = $this-> create_user( array(134 $u1 = $this->factory->user->create( array( 135 135 'last_activity' => date( 'Y-m-d H:i:s', $now ), 136 136 ) ); 137 $u2 = $this-> create_user( array(137 $u2 = $this->factory->user->create( array( 138 138 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*4 ), 139 139 ) ); 140 $u3 = $this-> create_user( array(140 $u3 = $this->factory->user->create( array( 141 141 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*6 ), 142 142 ) ); … … 156 156 public function test_bp_user_query_search_with_apostrophe() { 157 157 // Apostrophe. Search_terms must escaped to mimic POST payload 158 $user_id = $this-> create_user();158 $user_id = $this->factory->user->create(); 159 159 xprofile_set_field_data( 1, $user_id, "Foo'Bar" ); 160 160 $q = new BP_User_Query( array( 'search_terms' => "oo\'Ba", ) ); … … 172 172 173 173 // LIKE special character: % 174 $user_id = $this-> create_user();174 $user_id = $this->factory->user->create(); 175 175 xprofile_set_field_data( 1, $user_id, "Foo%Bar" ); 176 176 $q = new BP_User_Query( array( 'search_terms' => "oo%Bar", ) ); … … 189 189 190 190 // LIKE special character: _ 191 $user_id = $this-> create_user();191 $user_id = $this->factory->user->create(); 192 192 xprofile_set_field_data( 1, $user_id, "Foo_Bar" ); 193 193 $q = new BP_User_Query( array( 'search_terms' => "oo_Bar", ) ); … … 205 205 206 206 // LIKE special character: & 207 $user_id = $this-> create_user();207 $user_id = $this->factory->user->create(); 208 208 xprofile_set_field_data( 1, $user_id, "a&mpersand" ); 209 209 $q = new BP_User_Query( array( 'search_terms' => "a&m", ) ); … … 223 223 */ 224 224 public function test_bp_user_query_search_core_fields() { 225 $user_id = $this-> create_user( array(225 $user_id = $this->factory->user->create( array( 226 226 'user_login' => 'foo', 227 227 ) ); … … 239 239 240 240 public function test_bp_user_query_search_wildcards() { 241 $u1 = $this-> create_user( array(241 $u1 = $this->factory->user->create( array( 242 242 'user_login' => 'xfoo', 243 243 ) ); … … 245 245 $q1 = new BP_User_Query( array( 'search_terms' => 'foo', 'search_wildcard' => 'left' ) ); 246 246 247 $u2 = $this-> create_user( array(247 $u2 = $this->factory->user->create( array( 248 248 'user_login' => 'foox', 249 249 ) ); … … 251 251 $q2 = new BP_User_Query( array( 'search_terms' => 'foo', 'search_wildcard' => 'right' ) ); 252 252 253 $u3 = $this-> create_user( array(253 $u3 = $this->factory->user->create( array( 254 254 'user_login' => 'xfoox', 255 255 ) ); … … 279 279 $existing_users = $wpdb->get_col( "SELECT ID FROM {$wpdb->users}" ); 280 280 281 $u1 = $this-> create_user();282 $u2 = $this-> create_user();281 $u1 = $this->factory->user->create(); 282 $u2 = $this->factory->user->create(); 283 283 284 284 $exclude = array_merge( array( $u1 ), $existing_users ); … … 307 307 add_filter( 'bp_disable_profile_sync', '__return_false' ); 308 308 309 $u1 = $this-> create_user();310 $u2 = $this-> create_user();309 $u1 = $this->factory->user->create(); 310 $u2 = $this->factory->user->create(); 311 311 312 312 global $wpdb; … … 338 338 */ 339 339 public function test_bp_user_query_type_alphabetical_spam_xprofileoff() { 340 $u1 = $this-> create_user();341 $u2 = $this-> create_user();340 $u1 = $this->factory->user->create(); 341 $u2 = $this->factory->user->create(); 342 342 343 343 // Make sure xprofile and profile sync are off … … 373 373 */ 374 374 public function test_bp_user_query_with_user_meta_argument() { 375 $u1 = $this-> create_user();376 $u2 = $this-> create_user();375 $u1 = $this->factory->user->create(); 376 $u2 = $this->factory->user->create(); 377 377 378 378 bp_update_user_meta( $u2, 'foo', 'bar' ); … … 395 395 */ 396 396 public function test_bp_user_query_with_user_meta_argument_no_user() { 397 $u1 = $this-> create_user();398 $u2 = $this-> create_user();397 $u1 = $this->factory->user->create(); 398 $u2 = $this->factory->user->create(); 399 399 400 400 $q = new BP_User_Query( array( -
trunk/tests/phpunit/testcases/core/nav.php
r8958 r9139 198 198 */ 199 199 public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_my_profile() { 200 $u = $this-> create_user();200 $u = $this->factory->user->create(); 201 201 $old_current_user = get_current_user_id(); 202 202 $this->set_current_user( $u ); … … 220 220 */ 221 221 public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_others_profile_default_component_accessible() { 222 $u1 = $this-> create_user();223 $u2 = $this-> create_user();222 $u1 = $this->factory->user->create(); 223 $u2 = $this->factory->user->create(); 224 224 $old_current_user = get_current_user_id(); 225 225 $this->set_current_user( $u1 ); … … 255 255 */ 256 256 public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_others_profile_default_component_not_accessible() { 257 $u1 = $this-> create_user();258 $u2 = $this-> create_user();257 $u1 = $this->factory->user->create(); 258 $u2 = $this->factory->user->create(); 259 259 $old_current_user = get_current_user_id(); 260 260 $this->set_current_user( $u1 ); … … 290 290 */ 291 291 public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_group() { 292 $u = $this-> create_user();292 $u = $this->factory->user->create(); 293 293 $g = $this->factory->group->create(); 294 294 $old_current_user = get_current_user_id(); … … 319 319 */ 320 320 public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_group_no_redirect_url_provided() { 321 $u = $this-> create_user();321 $u = $this->factory->user->create(); 322 322 $g = $this->factory->group->create(); 323 323 $old_current_user = get_current_user_id(); -
trunk/tests/phpunit/testcases/friends/activity.php
r8958 r9139 11 11 */ 12 12 public function test_bp_friends_format_activity_action_friendship_accepted() { 13 $u1 = $this-> create_user();14 $u2 = $this-> create_user();13 $u1 = $this->factory->user->create(); 14 $u2 = $this->factory->user->create(); 15 15 16 16 $a = $this->factory->activity->create( array( … … 33 33 */ 34 34 public function test_bp_friends_format_activity_action_friendship_created() { 35 $u1 = $this-> create_user();36 $u2 = $this-> create_user();35 $u1 = $this->factory->user->create(); 36 $u2 = $this->factory->user->create(); 37 37 38 38 $a = $this->factory->activity->create( array( -
trunk/tests/phpunit/testcases/friends/class-bp-friends-friendship.php
r8958 r9139 20 20 21 21 public function test_search_friends() { 22 $u1 = $this-> create_user();23 $u2 = $this-> create_user();24 $u3 = $this-> create_user();22 $u1 = $this->factory->user->create(); 23 $u2 = $this->factory->user->create(); 24 $u3 = $this->factory->user->create(); 25 25 26 26 xprofile_set_field_data( 1, $u2, 'Cool Dude' ); … … 35 35 36 36 public function test_get_bulk_last_active() { 37 $u1 = $this-> create_user( array(37 $u1 = $this->factory->user->create( array( 38 38 'last_activity' => gmdate( 'Y-m-d H:i:s' ), 39 39 ) ); 40 $u2 = $this-> create_user( array(40 $u2 = $this->factory->user->create( array( 41 41 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ), 42 42 ) ); 43 $u3 = $this-> create_user( array(43 $u3 = $this->factory->user->create( array( 44 44 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ), 45 45 ) ); … … 51 51 52 52 public function test_search_users() { 53 $u1 = $this-> create_user();54 $u2 = $this-> create_user();55 $u3 = $this-> create_user();53 $u1 = $this->factory->user->create(); 54 $u2 = $this->factory->user->create(); 55 $u3 = $this->factory->user->create(); 56 56 57 57 xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' ); … … 65 65 66 66 public function test_search_users_count() { 67 $u1 = $this-> create_user();68 $u2 = $this-> create_user();69 $u3 = $this-> create_user();67 $u1 = $this->factory->user->create(); 68 $u2 = $this->factory->user->create(); 69 $u3 = $this->factory->user->create(); 70 70 71 71 xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' ); … … 82 82 */ 83 83 public function test_check_is_friend_not_friends() { 84 $u1 = $this-> create_user();85 $u2 = $this-> create_user();84 $u1 = $this->factory->user->create(); 85 $u2 = $this->factory->user->create(); 86 86 $this->assertEquals( 'not_friends', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) ); 87 87 } … … 91 91 */ 92 92 public function test_check_is_friend_pending() { 93 $u1 = $this-> create_user();94 $u2 = $this-> create_user();93 $u1 = $this->factory->user->create(); 94 $u2 = $this->factory->user->create(); 95 95 friends_add_friend( $u1, $u2, false ); 96 96 $this->assertEquals( 'pending', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) ); … … 101 101 */ 102 102 public function test_check_is_friend_awaiting_response() { 103 $u1 = $this-> create_user();104 $u2 = $this-> create_user();103 $u1 = $this->factory->user->create(); 104 $u2 = $this->factory->user->create(); 105 105 friends_add_friend( $u1, $u2, false ); 106 106 $this->assertEquals( 'awaiting_response', BP_Friends_Friendship::check_is_friend( $u2, $u1 ) ); … … 111 111 */ 112 112 public function test_check_is_friend_is_friend() { 113 $u1 = $this-> create_user();114 $u2 = $this-> create_user();113 $u1 = $this->factory->user->create(); 114 $u2 = $this->factory->user->create(); 115 115 friends_add_friend( $u1, $u2, true ); 116 116 $this->assertEquals( 'is_friend', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) ); -
trunk/tests/phpunit/testcases/friends/functions.php
r8958 r9139 13 13 */ 14 14 public function test_requests_on_accept() { 15 $u1 = $this-> create_user();16 $u2 = $this-> create_user();17 $u3 = $this-> create_user();15 $u1 = $this->factory->user->create(); 16 $u2 = $this->factory->user->create(); 17 $u3 = $this->factory->user->create(); 18 18 19 19 // request friendship … … 42 42 */ 43 43 public function test_requests_on_request() { 44 $u1 = $this-> create_user();45 $u2 = $this-> create_user();46 $u3 = $this-> create_user();44 $u1 = $this->factory->user->create(); 45 $u2 = $this->factory->user->create(); 46 $u3 = $this->factory->user->create(); 47 47 48 48 // request friendship … … 67 67 */ 68 68 public function test_requests_on_withdraw() { 69 $u1 = $this-> create_user();70 $u2 = $this-> create_user();69 $u1 = $this->factory->user->create(); 70 $u2 = $this->factory->user->create(); 71 71 72 72 // request friendship … … 95 95 */ 96 96 public function test_requests_on_reject() { 97 $u1 = $this-> create_user();98 $u2 = $this-> create_user();97 $u1 = $this->factory->user->create(); 98 $u2 = $this->factory->user->create(); 99 99 100 100 // request friendship … … 121 121 */ 122 122 public function test_friends_add_friend_fail_on_self() { 123 $u1 = $this-> create_user();123 $u1 = $this->factory->user->create(); 124 124 $this->assertFalse( friends_add_friend( $u1, $u1 ) ); 125 125 } … … 129 129 */ 130 130 public function test_friends_add_friend_already_friends() { 131 $u1 = $this-> create_user();132 $u2 = $this-> create_user();131 $u1 = $this->factory->user->create(); 132 $u2 = $this->factory->user->create(); 133 133 134 134 friends_add_friend( $u1, $u2, true ); … … 142 142 public function test_friends_check_friendship_status_in_members_loop() { 143 143 $now = time(); 144 $u1 = $this-> create_user( array(144 $u1 = $this->factory->user->create( array( 145 145 'last_activity' => date( 'Y-m-d H:i:s', $now ), 146 146 ) ); 147 $u2 = $this-> create_user( array(147 $u2 = $this->factory->user->create( array( 148 148 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 149 149 ) ); 150 $u3 = $this-> create_user( array(150 $u3 = $this->factory->user->create( array( 151 151 'last_activity' => date( 'Y-m-d H:i:s', $now - 200 ), 152 152 ) ); 153 $u4 = $this-> create_user( array(153 $u4 = $this->factory->user->create( array( 154 154 'last_activity' => date( 'Y-m-d H:i:s', $now - 300 ), 155 155 ) ); 156 $u5 = $this-> create_user( array(156 $u5 = $this->factory->user->create( array( 157 157 'last_activity' => date( 'Y-m-d H:i:s', $now - 400 ), 158 158 ) ); … … 190 190 public function test_friends_check_friendship_status_not_in_members_loop() { 191 191 $now = time(); 192 $u1 = $this-> create_user( array(192 $u1 = $this->factory->user->create( array( 193 193 'last_activity' => date( 'Y-m-d H:i:s', $now ), 194 194 ) ); 195 $u2 = $this-> create_user( array(195 $u2 = $this->factory->user->create( array( 196 196 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 197 197 ) ); 198 $u3 = $this-> create_user( array(198 $u3 = $this->factory->user->create( array( 199 199 'last_activity' => date( 'Y-m-d H:i:s', $now - 200 ), 200 200 ) ); 201 $u4 = $this-> create_user( array(201 $u4 = $this->factory->user->create( array( 202 202 'last_activity' => date( 'Y-m-d H:i:s', $now - 300 ), 203 203 ) ); 204 $u5 = $this-> create_user( array(204 $u5 = $this->factory->user->create( array( 205 205 'last_activity' => date( 'Y-m-d H:i:s', $now - 400 ), 206 206 ) ); -
trunk/tests/phpunit/testcases/groups/activity.php
r8958 r9139 11 11 */ 12 12 public function test_bp_groups_format_activity_action_created_group() { 13 $u = $this-> create_user();13 $u = $this->factory->user->create(); 14 14 $g = $this->factory->group->create(); 15 15 $a = $this->factory->activity->create( array( … … 33 33 */ 34 34 public function test_bp_groups_format_activity_action_joined_group() { 35 $u = $this-> create_user();35 $u = $this->factory->user->create(); 36 36 $g = $this->factory->group->create(); 37 37 $a = $this->factory->activity->create( array( -
trunk/tests/phpunit/testcases/groups/cache.php
r8958 r9139 160 160 */ 161 161 public function test_groups_get_group_admins_cache() { 162 $u1 = $this-> create_user();163 $u2 = $this-> create_user();162 $u1 = $this->factory->user->create(); 163 $u2 = $this->factory->user->create(); 164 164 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 165 165 … … 182 182 */ 183 183 public function test_groups_get_group_admins_cache_on_member_save() { 184 $u1 = $this-> create_user();185 $u2 = $this-> create_user();184 $u1 = $this->factory->user->create(); 185 $u2 = $this->factory->user->create(); 186 186 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 187 187 -
trunk/tests/phpunit/testcases/groups/class-bp-group-extension.php
r8958 r9139 293 293 294 294 // Test as group member 295 $u = $this-> create_user();295 $u = $this->factory->user->create(); 296 296 $this->set_current_user( $u ); 297 297 $this->add_user_to_group( $u, $g ); … … 336 336 337 337 // Test as group member 338 $u = $this-> create_user();338 $u = $this->factory->user->create(); 339 339 $this->set_current_user( $u ); 340 340 $this->add_user_to_group( $u, $g ); … … 422 422 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 423 423 424 $u = $this-> create_user();424 $u = $this->factory->user->create(); 425 425 $old_current_user = get_current_user_id(); 426 426 $this->set_current_user( $u ); … … 464 464 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 465 465 466 $u = $this-> create_user();466 $u = $this->factory->user->create(); 467 467 $old_current_user = get_current_user_id(); 468 468 $this->set_current_user( $u ); … … 508 508 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 509 509 510 $u = $this-> create_user();510 $u = $this->factory->user->create(); 511 511 $old_current_user = get_current_user_id(); 512 512 $this->set_current_user( $u ); … … 554 554 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 555 555 556 $u = $this-> create_user();556 $u = $this->factory->user->create(); 557 557 $old_current_user = get_current_user_id(); 558 558 $this->set_current_user( $u ); … … 682 682 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 683 683 684 $u = $this-> create_user();684 $u = $this->factory->user->create(); 685 685 $old_current_user = get_current_user_id(); 686 686 $this->set_current_user( $u ); … … 724 724 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 725 725 726 $u = $this-> create_user();726 $u = $this->factory->user->create(); 727 727 $old_current_user = get_current_user_id(); 728 728 $this->set_current_user( $u ); … … 768 768 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 769 769 770 $u = $this-> create_user();770 $u = $this->factory->user->create(); 771 771 $old_current_user = get_current_user_id(); 772 772 $this->set_current_user( $u ); … … 814 814 $g_obj = groups_get_group( array( 'group_id' => $g ) ); 815 815 816 $u = $this-> create_user();816 $u = $this->factory->user->create(); 817 817 $old_current_user = get_current_user_id(); 818 818 $this->set_current_user( $u ); -
trunk/tests/phpunit/testcases/groups/class-bp-group-member-query.php
r9120 r9139 22 22 public function test_with_include() { 23 23 $g = $this->factory->group->create(); 24 $u1 = $this-> create_user();25 $u2 = $this-> create_user();26 $u3 = $this-> create_user();24 $u1 = $this->factory->user->create(); 25 $u2 = $this->factory->user->create(); 26 $u3 = $this->factory->user->create(); 27 27 $time = time(); 28 28 … … 42 42 public function test_with_group_role_null() { 43 43 $g = $this->factory->group->create(); 44 $u1 = $this-> create_user();45 $u2 = $this-> create_user();46 $u3 = $this-> create_user();44 $u1 = $this->factory->user->create(); 45 $u2 = $this->factory->user->create(); 46 $u3 = $this->factory->user->create(); 47 47 $time = time(); 48 48 … … 70 70 public function test_with_group_role_member() { 71 71 $g = $this->factory->group->create(); 72 $u1 = $this-> create_user();73 $u2 = $this-> create_user();74 $u3 = $this-> create_user();72 $u1 = $this->factory->user->create(); 73 $u2 = $this->factory->user->create(); 74 $u3 = $this->factory->user->create(); 75 75 $time = time(); 76 76 … … 95 95 public function test_with_group_role_mod() { 96 96 $g = $this->factory->group->create(); 97 $u1 = $this-> create_user();98 $u2 = $this-> create_user();99 $u3 = $this-> create_user();97 $u1 = $this->factory->user->create(); 98 $u2 = $this->factory->user->create(); 99 $u3 = $this->factory->user->create(); 100 100 $time = time(); 101 101 … … 119 119 120 120 public function test_with_group_role_admin() { 121 $u1 = $this-> create_user();122 $u2 = $this-> create_user();123 $u3 = $this-> create_user();121 $u1 = $this->factory->user->create(); 122 $u2 = $this->factory->user->create(); 123 $u3 = $this->factory->user->create(); 124 124 $g = $this->factory->group->create( array( 125 125 'creator_id' => $u1 … … 147 147 public function test_with_group_role_member_mod() { 148 148 $g = $this->factory->group->create(); 149 $u1 = $this-> create_user();150 $u2 = $this-> create_user();151 $u3 = $this-> create_user();149 $u1 = $this->factory->user->create(); 150 $u2 = $this->factory->user->create(); 151 $u3 = $this->factory->user->create(); 152 152 $time = time(); 153 153 … … 171 171 172 172 public function test_with_group_role_member_admin() { 173 $u1 = $this-> create_user();174 $u2 = $this-> create_user();175 $u3 = $this-> create_user();173 $u1 = $this->factory->user->create(); 174 $u2 = $this->factory->user->create(); 175 $u3 = $this->factory->user->create(); 176 176 $g = $this->factory->group->create( array( 177 177 'creator_id' => $u1, … … 198 198 199 199 public function test_with_group_role_mod_admin() { 200 $u1 = $this-> create_user();201 $u2 = $this-> create_user();202 $u3 = $this-> create_user();200 $u1 = $this->factory->user->create(); 201 $u2 = $this->factory->user->create(); 202 $u3 = $this->factory->user->create(); 203 203 $g = $this->factory->group->create( array( 204 204 'creator_id' => $u1, … … 225 225 226 226 public function test_with_group_role_member_mod_admin() { 227 $u1 = $this-> create_user();228 $u2 = $this-> create_user();229 $u3 = $this-> create_user();227 $u1 = $this->factory->user->create(); 228 $u2 = $this->factory->user->create(); 229 $u3 = $this->factory->user->create(); 230 230 $g = $this->factory->group->create( array( 231 231 'creator_id' => $u1, … … 252 252 253 253 public function test_with_group_role_member_mod_admin_banned() { 254 $u1 = $this-> create_user();255 $u2 = $this-> create_user();256 $u3 = $this-> create_user();257 $u4 = $this-> create_user();254 $u1 = $this->factory->user->create(); 255 $u2 = $this->factory->user->create(); 256 $u3 = $this->factory->user->create(); 257 $u4 = $this->factory->user->create(); 258 258 $g = $this->factory->group->create( array( 259 259 'creator_id' => $u1, … … 287 287 public function test_with_group_role_banned() { 288 288 $g = $this->factory->group->create(); 289 $u1 = $this-> create_user();290 $u2 = $this-> create_user();289 $u1 = $this->factory->user->create(); 290 $u2 = $this->factory->user->create(); 291 291 $time = time(); 292 292 … … 308 308 public function test_group_has_no_members_of_role_mod() { 309 309 $g = $this->factory->group->create(); 310 $u1 = $this-> create_user();310 $u1 = $this->factory->user->create(); 311 311 $time = time(); 312 312 … … 324 324 public function test_confirmed_members() { 325 325 $g = $this->factory->group->create(); 326 $u1 = $this-> create_user();327 $u2 = $this-> create_user();326 $u1 = $this->factory->user->create(); 327 $u2 = $this->factory->user->create(); 328 328 $time = time(); 329 329 … … 351 351 public function test_get_with_type_last_joined() { 352 352 $g = $this->factory->group->create(); 353 $u1 = $this-> create_user();354 $u2 = $this-> create_user();353 $u1 = $this->factory->user->create(); 354 $u2 = $this->factory->user->create(); 355 355 $time = time(); 356 356 … … 377 377 public function test_get_with_type_first_joined() { 378 378 $g = $this->factory->group->create(); 379 $u1 = $this-> create_user();380 $u2 = $this-> create_user();379 $u1 = $this->factory->user->create(); 380 $u2 = $this->factory->user->create(); 381 381 $time = time(); 382 382 … … 404 404 public function test_get_with_type_group_activity_with_activity_component_disabled() { 405 405 $g = $this->factory->group->create(); 406 $u1 = $this-> create_user();407 $u2 = $this-> create_user();408 $u3 = $this-> create_user();406 $u1 = $this->factory->user->create(); 407 $u2 = $this->factory->user->create(); 408 $u3 = $this->factory->user->create(); 409 409 $c = buddypress()->groups->id; 410 410 $time = time(); … … 475 475 public function test_get_with_type_group_activity() { 476 476 $g = $this->factory->group->create(); 477 $u1 = $this-> create_user();478 $u2 = $this-> create_user();479 $u3 = $this-> create_user();477 $u1 = $this->factory->user->create(); 478 $u2 = $this->factory->user->create(); 479 $u3 = $this->factory->user->create(); 480 480 $c = buddypress()->groups->id; 481 481 $time = time(); … … 532 532 public function test_get_with_type_group_activity_no_dupes() { 533 533 $g = $this->factory->group->create(); 534 $u1 = $this-> create_user();534 $u1 = $this->factory->user->create(); 535 535 $c = buddypress()->groups->id; 536 536 $time = time(); … … 569 569 public function test_get_with_type_alphabetical() { 570 570 $g = $this->factory->group->create(); 571 $u1 = $this-> create_user( array(571 $u1 = $this->factory->user->create( array( 572 572 'display_name' => 'AAA', 573 573 ) ); 574 $u2 = $this-> create_user( array(574 $u2 = $this->factory->user->create( array( 575 575 'display_name' => 'CCC', 576 576 ) ); 577 $u3 = $this-> create_user( array(577 $u3 = $this->factory->user->create( array( 578 578 'display_name' => 'BBB', 579 579 ) ); … … 606 606 public function test_with_invite_sent_true() { 607 607 $g = $this->factory->group->create(); 608 $u1 = $this-> create_user();609 $u2 = $this-> create_user();608 $u1 = $this->factory->user->create(); 609 $u2 = $this->factory->user->create(); 610 610 $time = time(); 611 611 … … 637 637 public function test_with_invite_sent_false() { 638 638 $g = $this->factory->group->create(); 639 $u1 = $this-> create_user();640 $u2 = $this-> create_user();639 $u1 = $this->factory->user->create(); 640 $u2 = $this->factory->user->create(); 641 641 $time = time(); 642 642 … … 668 668 public function test_with_inviter_id_false() { 669 669 $g = $this->factory->group->create(); 670 $u1 = $this-> create_user();671 $u2 = $this-> create_user();670 $u1 = $this->factory->user->create(); 671 $u2 = $this->factory->user->create(); 672 672 $time = time(); 673 673 … … 696 696 public function test_with_inviter_id_specific() { 697 697 $g = $this->factory->group->create(); 698 $u1 = $this-> create_user();699 $u2 = $this-> create_user();700 $u3 = $this-> create_user();701 $u4 = $this-> create_user();698 $u1 = $this->factory->user->create(); 699 $u2 = $this->factory->user->create(); 700 $u3 = $this->factory->user->create(); 701 $u4 = $this->factory->user->create(); 702 702 $time = time(); 703 703 … … 736 736 public function test_with_inviter_id_any() { 737 737 $g = $this->factory->group->create(); 738 $u1 = $this-> create_user();739 $u2 = $this-> create_user();740 $u3 = $this-> create_user();741 $u4 = $this-> create_user();738 $u1 = $this->factory->user->create(); 739 $u2 = $this->factory->user->create(); 740 $u3 = $this->factory->user->create(); 741 $u4 = $this->factory->user->create(); 742 742 $time = time(); 743 743 -
trunk/tests/phpunit/testcases/groups/class-bp-groups-group.php
r9107 r9139 903 903 */ 904 904 public function test_get_group_extras_non_member() { 905 $u = $this-> create_user();905 $u = $this->factory->user->create(); 906 906 $g = $this->factory->group->create(); 907 907 … … 934 934 */ 935 935 public function test_get_group_extras_member() { 936 $u = $this-> create_user();936 $u = $this->factory->user->create(); 937 937 $g = $this->factory->group->create(); 938 938 $this->add_user_to_group( $u, $g ); … … 966 966 */ 967 967 public function test_get_group_extras_invited() { 968 $u = $this-> create_user();968 $u = $this->factory->user->create(); 969 969 $g = $this->factory->group->create(); 970 970 … … 1005 1005 */ 1006 1006 public function test_get_group_extras_pending() { 1007 $u = $this-> create_user();1007 $u = $this->factory->user->create(); 1008 1008 $g = $this->factory->group->create(); 1009 1009 … … 1044 1044 */ 1045 1045 public function test_get_group_extras_banned() { 1046 $u = $this-> create_user();1046 $u = $this->factory->user->create(); 1047 1047 $g = $this->factory->group->create(); 1048 1048 -
trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php
r8958 r9139 117 117 $g1 = $this->factory->group->create(); 118 118 119 $u1 = $this-> create_user();120 $u2 = $this-> create_user();119 $u1 = $this->factory->user->create(); 120 $u2 = $this->factory->user->create(); 121 121 self::add_user_to_group( $u1, $g1 ); 122 122 self::add_user_to_group( $u2, $g1 ); -
trunk/tests/phpunit/testcases/groups/functions.php
r9137 r9139 19 19 20 20 public function test_creating_new_group_as_authenticated_user() { 21 $u = $this-> create_user();21 $u = $this->factory->user->create(); 22 22 wp_set_current_user( $u ); 23 23 … … 30 30 */ 31 31 public function test_total_group_count_groups_join_group() { 32 $u1 = $this-> create_user();33 $u2 = $this-> create_user();32 $u1 = $this->factory->user->create(); 33 $u2 = $this->factory->user->create(); 34 34 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 35 35 … … 43 43 */ 44 44 public function test_total_group_count_groups_leave_group() { 45 $u1 = $this-> create_user();46 $u2 = $this-> create_user();45 $u1 = $this->factory->user->create(); 46 $u2 = $this->factory->user->create(); 47 47 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 48 48 $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); … … 59 59 */ 60 60 public function test_total_group_count_groups_ban_member() { 61 $u1 = $this-> create_user();62 $u2 = $this-> create_user();61 $u1 = $this->factory->user->create(); 62 $u2 = $this->factory->user->create(); 63 63 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 64 64 $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); … … 80 80 */ 81 81 public function test_total_group_count_groups_unban_member() { 82 $u1 = $this-> create_user();83 $u2 = $this-> create_user();82 $u1 = $this->factory->user->create(); 83 $u2 = $this->factory->user->create(); 84 84 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 85 85 $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); … … 103 103 */ 104 104 public function test_total_group_count_groups_accept_invite() { 105 $u1 = $this-> create_user();106 $u2 = $this-> create_user();105 $u1 = $this->factory->user->create(); 106 $u2 = $this->factory->user->create(); 107 107 $g = $this->factory->group->create(); 108 108 groups_invite_user( array( … … 122 122 */ 123 123 public function test_total_group_count_groups_accept_membership_request() { 124 $u = $this-> create_user();124 $u = $this->factory->user->create(); 125 125 $g = $this->factory->group->create(); 126 126 groups_send_membership_request( $u, $g ); … … 136 136 */ 137 137 public function test_total_group_count_groups_remove_member() { 138 $u1 = $this-> create_user();139 $u2 = $this-> create_user();138 $u1 = $this->factory->user->create(); 139 $u2 = $this->factory->user->create(); 140 140 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 141 141 $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); … … 157 157 */ 158 158 public function test_total_member_count_groups_join_group() { 159 $u1 = $this-> create_user();160 $u2 = $this-> create_user();159 $u1 = $this->factory->user->create(); 160 $u2 = $this->factory->user->create(); 161 161 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 162 162 … … 170 170 */ 171 171 public function test_total_member_count_groups_leave_group() { 172 $u1 = $this-> create_user();172 $u1 = $this->factory->user->create(); 173 173 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 174 174 groups_join_group( $g1, $u1 ); … … 183 183 */ 184 184 public function test_total_member_count_groups_ban_member() { 185 $u1 = $this-> create_user();186 $u2 = $this-> create_user();185 $u1 = $this->factory->user->create(); 186 $u2 = $this->factory->user->create(); 187 187 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 188 188 groups_join_group( $g1, $u2 ); … … 202 202 */ 203 203 public function test_total_member_count_groups_unban_member() { 204 $u1 = $this-> create_user();205 $u2 = $this-> create_user();204 $u1 = $this->factory->user->create(); 205 $u2 = $this->factory->user->create(); 206 206 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 207 207 groups_join_group( $g1, $u2 ); … … 223 223 */ 224 224 public function test_total_member_count_groups_accept_invite() { 225 $u1 = $this-> create_user();226 $u2 = $this-> create_user();225 $u1 = $this->factory->user->create(); 226 $u2 = $this->factory->user->create(); 227 227 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 228 228 groups_invite_user( array( … … 242 242 */ 243 243 public function test_total_member_count_groups_accept_membership_request() { 244 $u1 = $this-> create_user();245 $u2 = $this-> create_user();244 $u1 = $this->factory->user->create(); 245 $u2 = $this->factory->user->create(); 246 246 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 247 247 … … 257 257 */ 258 258 public function test_total_member_count_groups_remove_member() { 259 $u1 = $this-> create_user();260 $u2 = $this-> create_user();259 $u1 = $this->factory->user->create(); 260 $u2 = $this->factory->user->create(); 261 261 $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 262 262 groups_join_group( $g1, $u2 ); … … 276 276 */ 277 277 public function test_total_member_count_groups_create_group() { 278 $u1 = $this-> create_user();278 $u1 = $this->factory->user->create(); 279 279 $g = groups_create_group( array( 280 280 'creator_id' => $u1, … … 602 602 public function test_groups_get_group_cache_different_users() { 603 603 $g = $this->factory->group->create(); 604 $u1 = $this-> create_user();605 $u2 = $this-> create_user();604 $u1 = $this->factory->user->create(); 605 $u2 = $this->factory->user->create(); 606 606 $this->add_user_to_group( $u1, $g ); 607 607 … … 624 624 */ 625 625 public function test_get_invite_count_for_user() { 626 $u1 = $this-> create_user();627 $u2 = $this-> create_user();626 $u1 = $this->factory->user->create(); 627 $u2 = $this->factory->user->create(); 628 628 $g = $this->factory->group->create( array( 'creator_id' => $u1 ) ); 629 629 -
trunk/tests/phpunit/testcases/groups/template.php
r9120 r9139 132 132 */ 133 133 public function test_bp_group_has_members_vanilla() { 134 $u1 = $this-> create_user();135 $u2 = $this-> create_user();134 $u1 = $this->factory->user->create(); 135 $u2 = $this->factory->user->create(); 136 136 $g = $this->factory->group->create( array( 137 137 'creator_id' => $u1, … … 160 160 */ 161 161 public function test_bp_group_has_members_backpat_retval_format() { 162 $u1 = $this-> create_user();163 $u2 = $this-> create_user();162 $u1 = $this->factory->user->create(); 163 $u2 = $this->factory->user->create(); 164 164 $g = $this->factory->group->create( array( 'creator_id' => $u2 ) ); 165 165 … … 204 204 $users = array(); 205 205 for ( $i = 1; $i <= 10; $i++ ) { 206 $users[ $i ] = $this-> create_user();206 $users[ $i ] = $this->factory->user->create(); 207 207 } 208 208 … … 242 242 $users = array(); 243 243 for ( $i = 1; $i <= 10; $i++ ) { 244 $users[ $i ] = $this-> create_user();244 $users[ $i ] = $this->factory->user->create(); 245 245 } 246 246 … … 265 265 public function test_bp_group_has_members_with_exclude() { 266 266 $g = $this->factory->group->create(); 267 $u1 = $this-> create_user();268 $u2 = $this-> create_user();267 $u1 = $this->factory->user->create(); 268 $u2 = $this->factory->user->create(); 269 269 270 270 $this->add_user_to_group( $u1, $g ); … … 286 286 public function test_bp_group_has_members_with_exclude_admins_mods_1() { 287 287 $g = $this->factory->group->create(); 288 $u1 = $this-> create_user();289 $u2 = $this-> create_user();290 $u3 = $this-> create_user();288 $u1 = $this->factory->user->create(); 289 $u2 = $this->factory->user->create(); 290 $u3 = $this->factory->user->create(); 291 291 292 292 $this->add_user_to_group( $u1, $g ); … … 313 313 */ 314 314 public function test_bp_group_has_members_with_exclude_admins_mods_0() { 315 $u1 = $this-> create_user();316 $u2 = $this-> create_user();317 $u3 = $this-> create_user();315 $u1 = $this->factory->user->create(); 316 $u2 = $this->factory->user->create(); 317 $u3 = $this->factory->user->create(); 318 318 $g = $this->factory->group->create( array( 319 319 'creator_id' => $u1, … … 348 348 public function test_bp_group_has_members_with_exclude_banned_1() { 349 349 $g = $this->factory->group->create(); 350 $u1 = $this-> create_user();351 $u2 = $this-> create_user();350 $u1 = $this->factory->user->create(); 351 $u2 = $this->factory->user->create(); 352 352 353 353 $this->add_user_to_group( $u1, $g ); … … 371 371 */ 372 372 public function test_bp_group_has_members_with_exclude_banned_0() { 373 $u1 = $this-> create_user();374 $u2 = $this-> create_user();375 $u3 = $this-> create_user();373 $u1 = $this->factory->user->create(); 374 $u2 = $this->factory->user->create(); 375 $u3 = $this->factory->user->create(); 376 376 377 377 $g = $this->factory->group->create( array( … … 409 409 public function test_bp_group_has_members_default_order() { 410 410 $now = time(); 411 $u1 = $this-> create_user( array(411 $u1 = $this->factory->user->create( array( 412 412 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60 ), 413 413 ) ); 414 $u2 = $this-> create_user( array(414 $u2 = $this->factory->user->create( array( 415 415 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 600 ), 416 416 ) ); 417 $u3 = $this-> create_user( array(417 $u3 = $this->factory->user->create( array( 418 418 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 6000 ), 419 419 ) ); … … 448 448 public function test_bp_group_has_invites_template_structure() { 449 449 $now = time(); 450 $u1 = $this-> create_user( array(450 $u1 = $this->factory->user->create( array( 451 451 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60 ), 452 452 ) ); 453 $u2 = $this-> create_user( array(453 $u2 = $this->factory->user->create( array( 454 454 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 600 ), 455 455 ) ); 456 $u3 = $this-> create_user( array(456 $u3 = $this->factory->user->create( array( 457 457 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 6000 ), 458 458 ) ); 459 $u4 = $this-> create_user( array(459 $u4 = $this->factory->user->create( array( 460 460 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60000 ), 461 461 ) ); … … 528 528 */ 529 529 public function test_bp_group_has_invites_pagination() { 530 $u1 = $this-> create_user( array(530 $u1 = $this->factory->user->create( array( 531 531 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 60 ), 532 532 ) ); … … 539 539 $now = time(); 540 540 for ( $i = 1; $i < 15; $i++ ) { 541 $users[ $i ] = $this-> create_user( array(541 $users[ $i ] = $this->factory->user->create( array( 542 542 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - $i ), 543 543 ) ); … … 572 572 public function test_bp_group_has_membership_requests_results() { 573 573 $now = time(); 574 $u1 = $this-> create_user( array(574 $u1 = $this->factory->user->create( array( 575 575 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60 ), 576 576 ) ); … … 583 583 $memberships = array(); 584 584 for ( $i = 1; $i < 15; $i++ ) { 585 $users[ $i ] = $this-> create_user( array(585 $users[ $i ] = $this->factory->user->create( array( 586 586 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - ( 100 - $i ) ), 587 587 ) ); … … 636 636 */ 637 637 public function test_bp_group_has_membership_requests_format() { 638 $u1 = $this-> create_user( array(638 $u1 = $this->factory->user->create( array( 639 639 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 60 ), 640 640 ) ); … … 646 646 $time = time(); 647 647 648 $user = $this-> create_user( array(648 $user = $this->factory->user->create( array( 649 649 'last_activity' => gmdate( 'Y-m-d H:i:s', $time ), 650 650 ) ); … … 705 705 public function test_bp_group_is_user_banned_in_groups_loop() { 706 706 $now = time(); 707 $u1 = $this-> create_user( array(707 $u1 = $this->factory->user->create( array( 708 708 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 709 709 ) ); 710 $u2 = $this-> create_user( array(710 $u2 = $this->factory->user->create( array( 711 711 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 712 712 ) ); … … 758 758 public function test_bp_group_is_user_banned_not_in_groups_loop() { 759 759 $now = time(); 760 $u1 = $this-> create_user( array(760 $u1 = $this->factory->user->create( array( 761 761 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 762 762 ) ); 763 $u2 = $this-> create_user( array(763 $u2 = $this->factory->user->create( array( 764 764 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 765 765 ) ); -
trunk/tests/phpunit/testcases/members/functions.php
r9123 r9139 96 96 */ 97 97 public function test_bp_core_get_user_displayname_translate_username() { 98 $u = $this-> create_user();98 $u = $this->factory->user->create(); 99 99 100 100 $user = new WP_User( $u ); … … 120 120 buddypress()->active_components['xprofile'] = '1'; 121 121 122 $u = $this-> create_user( array(122 $u = $this->factory->user->create( array( 123 123 'display_name' => 'Foo', 124 124 ) ); … … 140 140 buddypress()->active_components['xprofile'] = '1'; 141 141 142 $u = $this-> create_user();142 $u = $this->factory->user->create(); 143 143 xprofile_set_field_data( 1, $u, 'Foo Foo' ); 144 144 … … 157 157 buddypress()->active_components['xprofile'] = '1'; 158 158 159 $u = $this-> create_user();159 $u = $this->factory->user->create(); 160 160 xprofile_set_field_data( 1, $u, 'Foo Foo' ); 161 161 … … 174 174 buddypress()->active_components['xprofile'] = '1'; 175 175 176 $u = $this-> create_user( array(176 $u = $this->factory->user->create( array( 177 177 'display_name' => 'Foo Foo', 178 178 ) ); … … 205 205 */ 206 206 public function test_bp_core_get_user_displaynames_all_uncached() { 207 $u1 = $this-> create_user();208 $u2 = $this-> create_user();207 $u1 = $this->factory->user->create(); 208 $u2 = $this->factory->user->create(); 209 209 210 210 xprofile_set_field_data( 1, $u1, 'Foo' ); … … 223 223 */ 224 224 public function test_bp_core_get_user_displaynames_one_not_in_xprofile() { 225 $u1 = $this-> create_user();226 $u2 = $this-> create_user( array(225 $u1 = $this->factory->user->create(); 226 $u2 = $this->factory->user->create( array( 227 227 'display_name' => 'Bar', 228 228 ) ); … … 249 249 */ 250 250 public function test_bp_core_get_user_displaynames_one_in_cache() { 251 $u1 = $this-> create_user();251 $u1 = $this->factory->user->create(); 252 252 xprofile_set_field_data( 1, $u1, 'Foo' ); 253 253 … … 268 268 */ 269 269 public function test_bp_members_migrate_signups_standard() { 270 $u = $this-> create_user();270 $u = $this->factory->user->create(); 271 271 $u_obj = new WP_User( $u ); 272 272 … … 302 302 */ 303 303 public function test_bp_members_migrate_signups_activation_key_but_user_status_0() { 304 $u = $this-> create_user();304 $u = $this->factory->user->create(); 305 305 $u_obj = new WP_User( $u ); 306 306 … … 333 333 */ 334 334 public function test_bp_members_migrate_signups_no_activation_key_but_user_status_2() { 335 $u = $this-> create_user();335 $u = $this->factory->user->create(); 336 336 $u_obj = new WP_User( $u ); 337 337 -
trunk/tests/phpunit/testcases/members/template.php
r9045 r9139 21 21 22 22 public function test_bp_has_members_include_on_user_page() { 23 $u1 = $this-> create_user();24 $u2 = $this-> create_user();23 $u1 = $this->factory->user->create(); 24 $u2 = $this->factory->user->create(); 25 25 26 26 $this->go_to( bp_core_get_user_domain( $u1 ) ); … … 46 46 */ 47 47 public function test_bp_has_members_search_pagination_with_spaces() { 48 $u1 = $this-> create_user( array( 'display_name' => '~ tilde u1' ) );49 $u2 = $this-> create_user( array( 'display_name' => '~ tilde u2' ) );48 $u1 = $this->factory->user->create( array( 'display_name' => '~ tilde u1' ) ); 49 $u2 = $this->factory->user->create( array( 'display_name' => '~ tilde u2' ) ); 50 50 51 51 $template_args = array( … … 68 68 69 69 public function test_bp_has_members_friendship_requests() { 70 $u1 = $this-> create_user();71 $u2 = $this-> create_user();70 $u1 = $this->factory->user->create(); 71 $u2 = $this->factory->user->create(); 72 72 73 73 friends_add_friend( $u1, $u2 ); … … 97 97 */ 98 98 public function test_bp_has_members_friendship_requests_with_no_requests() { 99 $u1 = $this-> create_user();100 $u2 = $this-> create_user();99 $u1 = $this->factory->user->create(); 100 $u2 = $this->factory->user->create(); 101 101 102 102 $old_user = get_current_user_id(); -
trunk/tests/phpunit/testcases/messages/class.bp-messages-notice.php
r8958 r9139 11 11 parent::setUp(); 12 12 $this->old_current_user = get_current_user_id(); 13 $this->set_current_user( $this-> create_user( array( 'role' => 'administrator' ) ) );13 $this->set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 14 14 } 15 15 … … 44 44 // now get the new active notice 45 45 BP_Messages_Notice::get_active(); 46 46 47 47 // grab the cache and make sure it equals our new notice 48 48 $cache = wp_cache_get( 'active_notice', 'bp_messages' ); -
trunk/tests/phpunit/testcases/messages/class.bp-messages-thread.php
r8958 r9139 9 9 */ 10 10 public function test_get_current_threads_for_user_with_search_terms_inbox() { 11 $u1 = $this-> create_user();12 $u2 = $this-> create_user();11 $u1 = $this->factory->user->create(); 12 $u2 = $this->factory->user->create(); 13 13 14 14 $t1 = $this->factory->message->create( array( … … 36 36 */ 37 37 public function test_get_current_threads_for_user_with_search_terms_sentbox() { 38 $u1 = $this-> create_user();39 $u2 = $this-> create_user();38 $u1 = $this->factory->user->create(); 39 $u2 = $this->factory->user->create(); 40 40 41 41 $t1 = $this->factory->message->create( array( -
trunk/tests/phpunit/testcases/messages/functions.php
r8958 r9139 11 11 */ 12 12 public function test_get_unread_count() { 13 $u1 = $this-> create_user();14 $u2 = $this-> create_user();13 $u1 = $this->factory->user->create(); 14 $u2 = $this->factory->user->create(); 15 15 16 16 // send a private message -
trunk/tests/phpunit/testcases/messages/notifications.php
r8958 r9139 11 11 public function test_bp_messages_message_delete_notifications() { 12 12 $current_user = get_current_user_id(); 13 $u = $this-> create_user();13 $u = $this->factory->user->create(); 14 14 $this->set_current_user( $u ); 15 15 -
trunk/tests/phpunit/testcases/notifications/class-bp-notifications-notification.php
r8958 r9139 9 9 */ 10 10 public function test_get_null_component_name() { 11 $u = $this-> create_user();11 $u = $this->factory->user->create(); 12 12 $n1 = $this->factory->notification->create( array( 13 13 'component_name' => 'groups', … … 53 53 */ 54 54 public function test_get_total_count_null_component_name() { 55 $u = $this-> create_user();55 $u = $this->factory->user->create(); 56 56 $n1 = $this->factory->notification->create( array( 57 57 'component_name' => 'groups', … … 95 95 */ 96 96 public function test_get_total_count_with_component_name() { 97 $u = $this-> create_user();97 $u = $this->factory->user->create(); 98 98 $n1 = $this->factory->notification->create( array( 99 99 'component_name' => 'groups', … … 123 123 public function test_order_by_date() { 124 124 $now = time(); 125 $u = $this-> create_user();125 $u = $this->factory->user->create(); 126 126 $n1 = $this->factory->notification->create( array( 127 127 'component_name' => 'friends', … … 156 156 */ 157 157 public function test_is_new_true() { 158 $u = $this-> create_user();158 $u = $this->factory->user->create(); 159 159 $n1 = $this->factory->notification->create( array( 160 160 'component_name' => 'friends', … … 188 188 */ 189 189 public function test_is_new_false() { 190 $u = $this-> create_user();190 $u = $this->factory->user->create(); 191 191 $n1 = $this->factory->notification->create( array( 192 192 'component_name' => 'friends', … … 220 220 */ 221 221 public function test_is_new_both() { 222 $u = $this-> create_user();222 $u = $this->factory->user->create(); 223 223 $n1 = $this->factory->notification->create( array( 224 224 'component_name' => 'friends', … … 253 253 */ 254 254 public function test_get_with_search_terms() { 255 $u = $this-> create_user();255 $u = $this->factory->user->create(); 256 256 $n1 = $this->factory->notification->create( array( 257 257 'component_name' => 'friends', -
trunk/tests/phpunit/testcases/notifications/functions.php
r8958 r9139 6 6 class BP_Tests_Notifications_Functions extends BP_UnitTestCase { 7 7 public function test_cache_invalidation_all_for_user_on_save() { 8 $u = $this-> create_user();8 $u = $this->factory->user->create(); 9 9 $n1 = $this->factory->notification->create( array( 10 10 'component_name' => 'groups', … … 34 34 35 35 public function test_cache_invalidation_all_for_user_on_delete() { 36 $u = $this-> create_user();36 $u = $this->factory->user->create(); 37 37 $n1 = $this->factory->notification->create( array( 38 38 'component_name' => 'groups', … … 97 97 */ 98 98 public function test_bp_notifications_get_unread_notification_count_cache() { 99 $u1 = $this-> create_user();100 $u2 = $this-> create_user();99 $u1 = $this->factory->user->create(); 100 $u2 = $this->factory->user->create(); 101 101 102 102 $n1 = $this->factory->notification->create( array( … … 126 126 */ 127 127 public function test_bp_has_notifications_filtering() { 128 $u1 = $this-> create_user();129 $u2 = $this-> create_user();128 $u1 = $this->factory->user->create(); 129 $u2 = $this->factory->user->create(); 130 130 131 131 // create a mixture of different notifications -
trunk/tests/phpunit/testcases/xprofile/activity.php
r8958 r9139 278 278 */ 279 279 public function test_bp_xprofile_format_activity_action_new_avatar() { 280 $u = $this-> create_user();280 $u = $this->factory->user->create(); 281 281 $a = $this->factory->activity->create( array( 282 282 'component' => 'profile', … … 300 300 buddypress()->active_components['xprofile'] = '1'; 301 301 302 $u = $this-> create_user();302 $u = $this->factory->user->create(); 303 303 $a = $this->factory->activity->create( array( 304 304 'component' => buddypress()->profile->id, … … 326 326 unset( buddypress()->active_components['xprofile'] ); 327 327 328 $u = $this-> create_user();328 $u = $this->factory->user->create(); 329 329 $a = $this->factory->activity->create( array( 330 330 'component' => buddypress()->profile->id, … … 349 349 */ 350 350 public function test_bp_xprofile_format_activity_action_updated_profile() { 351 $u = $this-> create_user();351 $u = $this->factory->user->create(); 352 352 $a = $this->factory->activity->create( array( 353 353 'component' => buddypress()->profile->id, … … 364 364 365 365 protected function setup_updated_profile_data() { 366 $this->updated_profile_data['u'] = $this-> create_user();366 $this->updated_profile_data['u'] = $this->factory->user->create(); 367 367 $this->updated_profile_data['g'] = $this->factory->xprofile_group->create(); 368 368 $this->updated_profile_data['f'] = $this->factory->xprofile_field->create( array( -
trunk/tests/phpunit/testcases/xprofile/cache.php
r8958 r9139 10 10 */ 11 11 public function test_bp_xprofile_update_meta_cache() { 12 $u = $this-> create_user();12 $u = $this->factory->user->create(); 13 13 $g = $this->factory->xprofile_group->create(); 14 14 $f = $this->factory->xprofile_field->create( array( … … 65 65 */ 66 66 public function test_bp_has_profile_meta_cache() { 67 $u = $this-> create_user();67 $u = $this->factory->user->create(); 68 68 $g = $this->factory->xprofile_group->create(); 69 69 $f = $this->factory->xprofile_field->create( array( … … 119 119 */ 120 120 public function test_bp_has_profile_meta_cache_update_meta_cache_false() { 121 $u = $this-> create_user();121 $u = $this->factory->user->create(); 122 122 $g = $this->factory->xprofile_group->create(); 123 123 $f = $this->factory->xprofile_field->create( array( -
trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-group.php
r8958 r9139 10 10 */ 11 11 public function test_fetch_visibility_level() { 12 $u = $this-> create_user();12 $u = $this->factory->user->create(); 13 13 $g = $this->factory->xprofile_group->create(); 14 14 $f = $this->factory->xprofile_field->create( array( -
trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-profiledata.php
r8958 r9139 10 10 */ 11 11 public function test_exists_when_doesnt_exist() { 12 $u = $this-> create_user();12 $u = $this->factory->user->create(); 13 13 $g = $this->factory->xprofile_group->create(); 14 14 $f = $this->factory->xprofile_field->create( array( … … 26 26 */ 27 27 public function test_exists_when_exists_uncached() { 28 $u = $this-> create_user();28 $u = $this->factory->user->create(); 29 29 $g = $this->factory->xprofile_group->create(); 30 30 $f = $this->factory->xprofile_field->create( array( … … 46 46 */ 47 47 public function test_exists_when_exists_in_cache() { 48 $u = $this-> create_user();48 $u = $this->factory->user->create(); 49 49 $g = $this->factory->xprofile_group->create(); 50 50 $f = $this->factory->xprofile_field->create( array( … … 66 66 */ 67 67 public function test_get_fielddataid_byid_when_doesnt_exist() { 68 $u = $this-> create_user();68 $u = $this->factory->user->create(); 69 69 $g = $this->factory->xprofile_group->create(); 70 70 $f = $this->factory->xprofile_field->create( array( … … 83 83 */ 84 84 public function test_get_fielddataid_byid_when_exists_uncached() { 85 $u = $this-> create_user();85 $u = $this->factory->user->create(); 86 86 $g = $this->factory->xprofile_group->create(); 87 87 $f = $this->factory->xprofile_field->create( array( … … 106 106 */ 107 107 public function test_get_fielddataid_byid_when_exists_in_cache() { 108 $u = $this-> create_user();108 $u = $this->factory->user->create(); 109 109 $g = $this->factory->xprofile_group->create(); 110 110 $f = $this->factory->xprofile_field->create( array( … … 125 125 */ 126 126 public function test_get_value_byid_singleuser_uncached() { 127 $u = $this-> create_user();127 $u = $this->factory->user->create(); 128 128 $g = $this->factory->xprofile_group->create(); 129 129 $f = $this->factory->xprofile_field->create( array( … … 150 150 $time = date( 'Y-m-d H:i:s', time() - 60*60*24 ); 151 151 152 $u1 = $this-> create_user();153 $u2 = $this-> create_user();152 $u1 = $this->factory->user->create(); 153 $u2 = $this->factory->user->create(); 154 154 $g = $this->factory->xprofile_group->create(); 155 155 $f = $this->factory->xprofile_field->create( array( … … 206 206 */ 207 207 public function test_get_value_byid_singleuser_cached() { 208 $u = $this-> create_user();208 $u = $this->factory->user->create(); 209 209 $g = $this->factory->xprofile_group->create(); 210 210 $f = $this->factory->xprofile_field->create( array( … … 230 230 $time = date( 'Y-m-d H:i:s', time() - 60*60*24 ); 231 231 232 $u1 = $this-> create_user();233 $u2 = $this-> create_user();232 $u1 = $this->factory->user->create(); 233 $u2 = $this->factory->user->create(); 234 234 $g = $this->factory->xprofile_group->create(); 235 235 $f = $this->factory->xprofile_field->create( array( … … 279 279 */ 280 280 public function test_get_all_for_user_uncached() { 281 $u = $this-> create_user();281 $u = $this->factory->user->create(); 282 282 $g1 = $this->factory->xprofile_group->create(); 283 283 $g2 = $this->factory->xprofile_group->create(); … … 358 358 */ 359 359 public function test_get_all_for_user_cached() { 360 $u = $this-> create_user();360 $u = $this->factory->user->create(); 361 361 $g1 = $this->factory->xprofile_group->create(); 362 362 $g2 = $this->factory->xprofile_group->create(); -
trunk/tests/phpunit/testcases/xprofile/functions.php
r9073 r9139 15 15 16 16 public function test_get_hidden_field_types_for_user_loggedout() { 17 $duser = $this-> create_user();17 $duser = $this->factory->user->create(); 18 18 19 19 $old_current_user = bp_loggedin_user_id(); … … 26 26 27 27 public function test_get_hidden_field_types_for_user_loggedin() { 28 $duser = $this-> create_user();29 $cuser = $this-> create_user();28 $duser = $this->factory->user->create(); 29 $cuser = $this->factory->user->create(); 30 30 31 31 $old_current_user = bp_loggedin_user_id(); … … 38 38 39 39 public function test_get_hidden_field_types_for_user_friends() { 40 $duser = $this-> create_user();41 $cuser = $this-> create_user();40 $duser = $this->factory->user->create(); 41 $cuser = $this->factory->user->create(); 42 42 friends_add_friend( $duser, $cuser, true ); 43 43 … … 51 51 52 52 public function test_get_hidden_field_types_for_user_admin() { 53 $duser = $this-> create_user();54 $cuser = $this-> create_user();53 $duser = $this->factory->user->create(); 54 $cuser = $this->factory->user->create(); 55 55 $this->grant_bp_moderate( $cuser ); 56 56 … … 107 107 */ 108 108 public function test_bp_xprofile_get_field_visibility_level_user_set() { 109 $u = $this-> create_user();109 $u = $this->factory->user->create(); 110 110 $g = $this->factory->xprofile_group->create(); 111 111 $f = $this->factory->xprofile_field->create( array( … … 126 126 */ 127 127 public function test_bp_xprofile_get_field_visibility_level_user_unset() { 128 $u = $this-> create_user();128 $u = $this->factory->user->create(); 129 129 $g = $this->factory->xprofile_group->create(); 130 130 $f = $this->factory->xprofile_field->create( array( … … 144 144 */ 145 145 public function test_bp_xprofile_get_field_visibility_level_admin_override() { 146 $u = $this-> create_user();146 $u = $this->factory->user->create(); 147 147 $g = $this->factory->xprofile_group->create(); 148 148 $f = $this->factory->xprofile_field->create( array( … … 538 538 */ 539 539 public function test_bp_get_member_profile_data_inside_loop() { 540 $u = $this-> create_user();540 $u = $this->factory->user->create(); 541 541 $g = $this->factory->xprofile_group->create(); 542 542 $f = $this->factory->xprofile_field->create( array( … … 563 563 */ 564 564 public function test_bp_get_member_profile_data_outside_of_loop() { 565 $u = $this-> create_user();565 $u = $this->factory->user->create(); 566 566 $g = $this->factory->xprofile_group->create(); 567 567 $f = $this->factory->xprofile_field->create( array( … … 584 584 */ 585 585 public function test_get_field_data_integer_zero() { 586 $u = $this-> create_user();586 $u = $this->factory->user->create(); 587 587 $g = $this->factory->xprofile_group->create(); 588 588 $f = $this->factory->xprofile_field->create( array(
Note: See TracChangeset
for help on using the changeset viewer.