Changeset 8986
- Timestamp:
- 09/07/2014 08:38:34 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-classes.php
r8816 r8986 388 388 global $wpdb, $bp; 389 389 390 if ( !is_numeric( $position ) ) 390 if ( !is_numeric( $position ) ) { 391 391 return false; 392 } 393 394 // purge profile field group cache 395 wp_cache_delete( 'xprofile_groups_inc_empty', 'bp' ); 392 396 393 397 return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_groups} SET group_order = %d WHERE id = %d", $position, $field_group_id ) ); -
trunk/tests/phpunit/testcases/xprofile/functions.php
r8958 r8986 615 615 $this->assertEquals( 5, $field->option_order ); 616 616 } 617 618 /** 619 * @group xprofile_update_field_group_position 620 * @group bp_profile_get_field_groups 621 */ 622 public function test_bp_profile_get_field_groups_update_position() { 623 $g1 = $this->factory->xprofile_group->create(); 624 $g2 = $this->factory->xprofile_group->create(); 625 $g3 = $this->factory->xprofile_group->create(); 626 627 // prime the cache 628 bp_profile_get_field_groups(); 629 630 // switch the field group positions for the last two groups 631 xprofile_update_field_group_position( $g2, 3 ); 632 xprofile_update_field_group_position( $g3, 2 ); 633 634 // now refetch field groups 635 $field_groups = bp_profile_get_field_groups(); 636 637 // assert! 638 $this->assertEquals( array( 1, $g1, $g3, $g2 ), wp_list_pluck( $field_groups, 'id' ) ); 639 } 617 640 }
Note: See TracChangeset
for help on using the changeset viewer.