Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/14/2014 01:59:32 PM (10 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/xprofile/functions.php

    r7878 r7879  
    280280     * @group bp_xprofile_get_meta
    281281     */
     282    public function test_bp_xprofile_get_meta_single_true() {
     283        $g = $this->factory->xprofile_group->create();
     284        bp_xprofile_add_meta( $g, 'group', 'foo', 'bar' );
     285        bp_xprofile_add_meta( $g, 'group', 'foo', 'baz' );
     286        $this->assertSame( 'bar', bp_xprofile_get_meta( $g, 'group', 'foo' ) ); // default is true
     287        $this->assertSame( 'bar', bp_xprofile_get_meta( $g, 'group', 'foo', true ) );
     288    }
     289
     290    /**
     291     * @group xprofilemeta
     292     * @group bp_xprofile_get_meta
     293     */
     294    public function test_bp_xprofile_get_meta_single_false() {
     295        $g = $this->factory->xprofile_group->create();
     296        bp_xprofile_add_meta( $g, 'group', 'foo', 'bar' );
     297        bp_xprofile_add_meta( $g, 'group', 'foo', 'baz' );
     298        $this->assertSame( array( 'bar', 'baz' ), bp_xprofile_get_meta( $g, 'group', 'foo', false ) );
     299    }
     300
     301    /**
     302     * @group xprofilemeta
     303     * @group bp_xprofile_get_meta
     304     */
    282305    public function test_bp_xprofile_get_meta_no_meta_key_no_results() {
    283306        $g = $this->factory->xprofile_group->create();
Note: See TracChangeset for help on using the changeset viewer.