Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/22/2015 09:48:26 PM (9 years ago)
Author:
boonebgorges
Message:

Fix syntax typo in BP_Friends_Friendship::save().

An extraneous bracket was making it impossible to save an existing friendship
object.

Props sbrajesh.
Fixes #6247.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/friends/class-bp-friends-friendship.php

    r9139 r9525  
    116116        $this->assertEquals( 'is_friend', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
    117117    }
     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    }
    118144}
Note: See TracChangeset for help on using the changeset viewer.