Changeset 8132
- Timestamp:
- 03/14/2014 12:50:26 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-functions.php
r8131 r8132 662 662 * metadata entries with the specified value. Otherwise, update all 663 663 * entries. 664 * @return bool True on success, false on failure. 664 * @return bool|int Returns false on failure. On successful update of existing 665 * metadata, returns true. On successful creation of new metadata, 666 * returns the integer ID of the new metadata row. 665 667 */ 666 668 function bp_activity_update_meta( $activity_id, $meta_key, $meta_value, $prev_value = '' ) { … … 674 676 $retval = update_metadata( 'activity', $activity_id, $meta_key, $meta_value, $prev_value ); 675 677 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 676 677 // Legacy - return true if we fall through to add_metadata()678 if ( is_int( $retval ) ) {679 $retval = true;680 }681 678 682 679 return $retval; -
trunk/bp-blogs/bp-blogs-functions.php
r8130 r8132 921 921 * metadata entries with the specified value. Otherwise, update all 922 922 * entries. 923 * @return bool True on success, false on failure. 923 * @return bool|int Returns false on failure. On successful update of existing 924 * metadata, returns true. On successful creation of new metadata, 925 * returns the integer ID of the new metadata row. 924 926 */ 925 927 function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value, $prev_value = '' ) { … … 928 930 $retval = update_metadata( 'blog', $blog_id, $meta_key, $meta_value, $prev_value ); 929 931 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 930 931 // Legacy - New items fall through to add_metadata(). Return true932 // instead of the ID returned from that function.933 if ( is_int( $retval ) ) {934 $retval = true;935 }936 932 937 933 return $retval; -
trunk/bp-groups/bp-groups-functions.php
r8129 r8132 1096 1096 * metadata entries with the specified value. Otherwise, update all 1097 1097 * entries. 1098 * @return bool True on success, false on failure. 1098 * @return bool|int Returns false on failure. On successful update of existing 1099 * metadata, returns true. On successful creation of new metadata, 1100 * returns the integer ID of the new metadata row. 1099 1101 */ 1100 1102 function groups_update_groupmeta( $group_id, $meta_key, $meta_value, $prev_value = '' ) { … … 1103 1105 $retval = update_metadata( 'group', $group_id, $meta_key, $meta_value, $prev_value ); 1104 1106 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 1105 1106 // Legacy - return true if we fall through to add_metadata()1107 if ( is_int( $retval ) ) {1108 $retval = true;1109 }1110 1107 1111 1108 return $retval; -
trunk/bp-xprofile/bp-xprofile-functions.php
r8130 r8132 665 665 * metadata entries with the specified value. Otherwise, update all 666 666 * entries. 667 * @return bool True on success, false on failure. 667 * @return bool|int Returns false on failure. On successful update of existing 668 * metadata, returns true. On successful creation of new metadata, 669 * returns the integer ID of the new metadata row. 668 670 */ 669 671 function bp_xprofile_update_meta( $object_id, $object_type, $meta_key, $meta_value, $prev_value = '' ) { … … 674 676 remove_filter( 'query', 'bp_xprofile_filter_meta_query' ); 675 677 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 676 677 // Legacy - if we fall through to add_metadata(), return true rather678 // than the integer meta_id679 if ( is_int( $retval ) ) {680 $retval = (bool) $retval;681 }682 678 683 679 return $retval; -
trunk/tests/testcases/activity/functions.php
r8131 r8132 165 165 $a = $this->factory->activity->create(); 166 166 $this->assertSame( '', bp_activity_get_meta( $a, 'foo' ), '"foo" meta should be empty for this activity item.' ); 167 $this->assert True( bp_activity_update_meta( $a, 'foo', 'bar' ) );167 $this->assertNotEmpty( bp_activity_update_meta( $a, 'foo', 'bar' ) ); 168 168 $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo' ) ); 169 169 } -
trunk/tests/testcases/blogs/functions.php
r8131 r8132 19 19 */ 20 20 public function test_bp_blogs_delete_blogmeta_illegal_characters() { 21 $this->assert True( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );21 $this->assertNotEmpty( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) ); 22 22 $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) ); 23 23 $krazy_key = ' f!@#$%^o *(){}o?+'; … … 32 32 */ 33 33 public function test_bp_blogs_delete_blogmeta_trim_meta_value() { 34 $this->assert True( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );34 $this->assertNotEmpty( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) ); 35 35 $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) ); 36 36 bp_blogs_delete_blogmeta( 1, 'foo', ' bar ' ); … … 193 193 */ 194 194 public function test_bp_blogs_update_blogmeta_new() { 195 $this->assert True( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) );195 $this->assertNotEmpty( bp_blogs_update_blogmeta( 1, 'foo', 'bar' ) ); 196 196 $this->assertSame( 'bar', bp_blogs_get_blogmeta( 1, 'foo' ) ); 197 197 } -
trunk/tests/testcases/groups/functions.php
r8131 r8132 309 309 $g = $this->factory->group->create(); 310 310 $this->assertSame( '', groups_get_groupmeta( $g, 'foo' ), '"foo" meta should be empty for this group.' ); 311 $this->assert True( groups_update_groupmeta( $g, 'foo', 'bar' ) );311 $this->assertNotEmpty( groups_update_groupmeta( $g, 'foo', 'bar' ) ); 312 312 $this->assertSame( 'bar', groups_get_groupmeta( $g, 'foo' ) ); 313 313 } … … 468 468 public function test_groups_delete_groupmeta_with_illegal_key_characters() { 469 469 $g = $this->factory->group->create(); 470 $this->assert True( groups_update_groupmeta( $g, 'foo', 'bar' ), 'Value of "foo" should be set at this point.' );470 $this->assertNotEmpty( groups_update_groupmeta( $g, 'foo', 'bar' ), 'Value of "foo" should be set at this point.' ); 471 471 472 472 $krazy_key = ' f!@#$%^o *(){}o?+'; -
trunk/tests/testcases/xprofile/functions.php
r8131 r8132 418 418 $g = $this->factory->xprofile_group->create(); 419 419 $this->assertSame( '', bp_xprofile_get_meta( $g, 'group', 'foo' ) ); 420 $this->assert True( bp_xprofile_update_meta( $g, 'group', 'foo', 'bar' ) );420 $this->assertNotEmpty( bp_xprofile_update_meta( $g, 'group', 'foo', 'bar' ) ); 421 421 $this->assertSame( 'bar', bp_xprofile_get_meta( $g, 'group', 'foo' ) ); 422 422 }
Note: See TracChangeset
for help on using the changeset viewer.