- Timestamp:
- 11/14/2014 02:01:18 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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(
Note: See TracChangeset
for help on using the changeset viewer.