| | 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 | } |