- Timestamp:
- 11/03/2017 07:44:10 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/friends/class-bp-friends-friendship.php
r11122 r11737 6 6 class BP_Tests_BP_Friends_Friendship_TestCases extends BP_UnitTestCase { 7 7 public function test_search_friends() { 8 $u1 = $this->factory->user->create();9 $u2 = $this->factory->user->create();10 $u3 = $this->factory->user->create();8 $u1 = self::factory()->user->create(); 9 $u2 = self::factory()->user->create(); 10 $u3 = self::factory()->user->create(); 11 11 12 12 xprofile_set_field_data( 1, $u2, 'Cool Dude' ); … … 26 26 $this->deactivate_component( 'xprofile' ); 27 27 28 $u1 = $this->factory->user->create();29 $u2 = $this->factory->user->create();30 $u3 = $this->factory->user->create();28 $u1 = self::factory()->user->create(); 29 $u2 = self::factory()->user->create(); 30 $u3 = self::factory()->user->create(); 31 31 32 32 add_user_meta( $u2, 'nickname', 'Cool Dude' ); … … 41 41 42 42 public function test_get_bulk_last_active() { 43 $u1 = $this->factory->user->create( array(43 $u1 = self::factory()->user->create( array( 44 44 'last_activity' => gmdate( 'Y-m-d H:i:s' ), 45 45 ) ); 46 $u2 = $this->factory->user->create( array(46 $u2 = self::factory()->user->create( array( 47 47 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ), 48 48 ) ); 49 $u3 = $this->factory->user->create( array(49 $u3 = self::factory()->user->create( array( 50 50 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ), 51 51 ) ); … … 57 57 58 58 public function test_search_users() { 59 $u1 = $this->factory->user->create();60 $u2 = $this->factory->user->create();61 $u3 = $this->factory->user->create();59 $u1 = self::factory()->user->create(); 60 $u2 = self::factory()->user->create(); 61 $u3 = self::factory()->user->create(); 62 62 63 63 xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' ); … … 71 71 72 72 public function test_search_users_count() { 73 $u1 = $this->factory->user->create();74 $u2 = $this->factory->user->create();75 $u3 = $this->factory->user->create();73 $u1 = self::factory()->user->create(); 74 $u2 = self::factory()->user->create(); 75 $u3 = self::factory()->user->create(); 76 76 77 77 xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' ); … … 88 88 */ 89 89 public function test_check_is_friend_not_friends() { 90 $u1 = $this->factory->user->create();91 $u2 = $this->factory->user->create();90 $u1 = self::factory()->user->create(); 91 $u2 = self::factory()->user->create(); 92 92 $this->assertEquals( 'not_friends', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) ); 93 93 } … … 97 97 */ 98 98 public function test_check_is_friend_pending() { 99 $u1 = $this->factory->user->create();100 $u2 = $this->factory->user->create();99 $u1 = self::factory()->user->create(); 100 $u2 = self::factory()->user->create(); 101 101 friends_add_friend( $u1, $u2, false ); 102 102 $this->assertEquals( 'pending', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) ); … … 107 107 */ 108 108 public function test_check_is_friend_awaiting_response() { 109 $u1 = $this->factory->user->create();110 $u2 = $this->factory->user->create();109 $u1 = self::factory()->user->create(); 110 $u2 = self::factory()->user->create(); 111 111 friends_add_friend( $u1, $u2, false ); 112 112 $this->assertEquals( 'awaiting_response', BP_Friends_Friendship::check_is_friend( $u2, $u1 ) ); … … 117 117 */ 118 118 public function test_check_is_friend_is_friend() { 119 $u1 = $this->factory->user->create();120 $u2 = $this->factory->user->create();119 $u1 = self::factory()->user->create(); 120 $u2 = self::factory()->user->create(); 121 121 friends_add_friend( $u1, $u2, true ); 122 122 $this->assertEquals( 'is_friend', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) ); … … 127 127 */ 128 128 public function test_save_method_should_update_existing_row() { 129 $u1 = $this->factory->user->create();130 $u2 = $this->factory->user->create();129 $u1 = self::factory()->user->create(); 130 $u2 = self::factory()->user->create(); 131 131 132 132 $friendship = new BP_Friends_Friendship(); … … 155 155 global $wpdb; 156 156 $now = time(); 157 $u1 = $this->factory->user->create( array(157 $u1 = self::factory()->user->create( array( 158 158 'last_activity' => date( 'Y-m-d H:i:s', $now ), 159 159 ) ); 160 $u2 = $this->factory->user->create( array(160 $u2 = self::factory()->user->create( array( 161 161 'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ), 162 162 ) );
Note: See TracChangeset
for help on using the changeset viewer.