Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/14/2014 07:21:52 PM (11 years ago)
Author:
boonebgorges
Message:

Add support for prev_value param to _update_meta() functions

This parameter, inherited from update_metadata(), allows you to limit your
updates only to rows where the meta_value matches your specified prev_value.

See #5400

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/activity/functions.php

    r7884 r7885  
    190190        $this->assertFalse( bp_activity_update_meta( $a, 'foo', 'bar' ) );
    191191        $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo' ) );
     192    }
     193
     194    /**
     195     * @group activitymeta
     196     * @group bp_activity_update_meta
     197     */
     198    public function test_bp_activity_update_meta_prev_value() {
     199        $a = $this->factory->activity->create();
     200        bp_activity_add_meta( $a, 'foo', 'bar' );
     201        $this->assertFalse( bp_activity_update_meta( $a, 'foo', 'bar2', 'baz' ) );
     202        $this->assertTrue( bp_activity_update_meta( $a, 'foo', 'bar2', 'bar' ) );
    192203    }
    193204
Note: See TracChangeset for help on using the changeset viewer.