Changeset 9525
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/classes/class-bp-friends-friendship.php
r9486 r9525 161 161 // Update 162 162 if (!empty( $this->id ) ) { 163 $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s )WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );163 $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) ); 164 164 165 165 // Save -
trunk/tests/phpunit/testcases/friends/class-bp-friends-friendship.php
r9139 r9525 116 116 $this->assertEquals( 'is_friend', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) ); 117 117 } 118 119 /** 120 * @group BP6247 121 */ 122 public function test_save_method_should_update_existing_row() { 123 $u1 = $this->factory->user->create(); 124 $u2 = $this->factory->user->create(); 125 126 $friendship = new BP_Friends_Friendship(); 127 $friendship->initiator_user_id = $u1; 128 $friendship->friend_user_id = $u2; 129 $friendship->is_confirmed = 0; 130 $friendship->is_limited = 0; 131 $friendship->date_created = bp_core_current_time(); 132 $friendship->is_confirmed = 1; 133 $friendship->save(); 134 135 $fid = $friendship->id; 136 137 $f = new BP_Friends_Friendship( $fid ); 138 $f->is_confirmed = 1; 139 $f->save(); 140 141 $f2 = new BP_Friends_Friendship( $fid ); 142 $this->assertEquals( 1, $f2->is_confirmed ); 143 } 118 144 }
Note: See TracChangeset
for help on using the changeset viewer.