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

    r8131 r8132  
    1919     */
    2020    public function test_bp_blogs_delete_blogmeta_illegal_characters() {
    21         $this->assertTrue( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
     21        $this->assertNotEmpty( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
    2222        $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) );
    2323        $krazy_key = ' f!@#$%^o *(){}o?+';
     
    3232     */
    3333    public function test_bp_blogs_delete_blogmeta_trim_meta_value() {
    34         $this->assertTrue( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
     34        $this->assertNotEmpty( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
    3535        $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) );
    3636        bp_blogs_delete_blogmeta( 1, 'foo', '   bar  ' );
     
    193193     */
    194194    public function test_bp_blogs_update_blogmeta_new() {
    195         $this->assertTrue( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
     195        $this->assertNotEmpty( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );
    196196        $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) );
    197197    }
Note: See TracChangeset for help on using the changeset viewer.