Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/14/2014 12:50:26 AM (10 years ago)
Author:
boonebgorges
Message:

In update_meta() functions, return integer value if a new metadata is created

Previously, BP update_meta() functions returned true on a successful update
*or* on the successful creation of new metadata. This is not consistent with
WP's update_metadata(), which on the creation of new metadata acts as a wrapper
for add_metadata(), which in turn returns an integer (the ID of the newly
created database row).

This changeset aligns BP's behavior with WP's.

We don't have any tests that directly address the data type returned by these
functions, but we do have a number of assertTrue assertions to verify the
setup of various tests. Where appropriate, these have been changed to the more
generous assertNotEmpty.

See #5399

File:
1 edited

Legend:

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

    r8131 r8132  
    165165        $a = $this->factory->activity->create();
    166166        $this->assertSame( '', bp_activity_get_meta( $a, 'foo' ), '"foo" meta should be empty for this activity item.' );
    167         $this->assertTrue( bp_activity_update_meta( $a, 'foo', 'bar' ) );
     167        $this->assertNotEmpty( bp_activity_update_meta( $a, 'foo', 'bar' ) );
    168168        $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo' ) );
    169169    }
Note: See TracChangeset for help on using the changeset viewer.