Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/07/2014 08:38:34 PM (12 years ago)
Author:
r-a-y
Message:

XProfile: Purge profile group cache when profile groups are reordered.

Commit also includes a unit test.

Fixes #5860.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/xprofile/functions.php

    r8958 r8986  
    615615                $this->assertEquals( 5, $field->option_order );
    616616        }
     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        }
    617640}
Note: See TracChangeset for help on using the changeset viewer.