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/blogs/functions.php

    r7883 r7885  
    186186    /**
    187187     * @group blogmeta
    188      * @group bp_blogs_update_groupmeta
     188     * @group bp_blogs_update_blogmeta
    189189     */
    190190    public function test_bp_blogs_update_blogmeta_new() {
     
    195195    /**
    196196     * @group blogmeta
    197      * @group bp_blogs_update_groupmeta
     197     * @group bp_blogs_update_blogmeta
    198198     */
    199199    public function test_bp_blogs_update_blogmeta_existing() {
     
    206206    /**
    207207     * @group blogmeta
    208      * @group bp_blogs_update_groupmeta
     208     * @group bp_blogs_update_blogmeta
    209209     */
    210210    public function test_bp_blogs_update_blogmeta_existing_no_change() {
     
    212212        $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) );
    213213        $this->assertFalse( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
     214    }
     215
     216    /**
     217     * @group blogmeta
     218     * @group bp_blogs_update_blogmeta
     219     */
     220    public function test_bp_blogs_update_meta_prev_value() {
     221        bp_blogs_add_blogmeta( 1, 'foo', 'bar' );
     222        $this->assertFalse( bp_blogs_update_blogmeta( 1, 'foo', 'bar2', 'baz' ) );
     223        $this->assertTrue( bp_blogs_update_blogmeta( 1, 'foo', 'bar2', 'bar' ) );
    214224    }
    215225
Note: See TracChangeset for help on using the changeset viewer.