Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/14/2014 01:59:32 PM (11 years ago)
Author:
boonebgorges
Message:

Add support for $single param in _get_meta() functions

Unlike get_metadata(), we are defaulting to $single = true, for backward
compatibility.

See #5400

File:
1 edited

Legend:

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

    r7874 r7879  
    259259    /**
    260260     * @group activitymeta
     261     * @group bp_activity_get_meta
     262     */
     263    public function test_bp_activity_get_meta_single_true() {
     264        $a = $this->factory->activity->create();
     265        bp_activity_add_meta( $a, 'foo', 'bar' );
     266        bp_activity_add_meta( $a, 'foo', 'baz' );
     267        $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo' ) ); // default is true
     268        $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo', true ) );
     269    }
     270
     271    /**
     272     * @group activitymeta
     273     * @group bp_activity_get_meta
     274     */
     275    public function test_bp_activity_get_meta_single_false() {
     276        $a = $this->factory->activity->create();
     277        bp_activity_add_meta( $a, 'foo', 'bar' );
     278        bp_activity_add_meta( $a, 'foo', 'baz' );
     279        $this->assertSame( array( 'bar', 'baz' ), bp_activity_get_meta( $a, 'foo', false ) );
     280    }
     281
     282    /**
     283     * @group activitymeta
    261284     * @group bp_activity_delete_meta
    262285     */
Note: See TracChangeset for help on using the changeset viewer.