Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/16/2014 07:30:37 PM (12 years ago)
Author:
boonebgorges
Message:

Record 'option_order' when passed through xprofile_insert_field()

Previously, this value was not recorded in the main part of BP_XProfile_Field.
Instead, the requisite option_order checking only happened when a parent field
was being saved via the UI.

Fixes #5472

File:
1 edited

Legend:

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

    r8518 r8535  
    591591                $this->assertNotEmpty( $f );
    592592        }
     593
     594        /**
     595         * @group xprofile_insert_field
     596         */
     597        public function test_xprofile_insert_field_type_option_option_order() {
     598                $g = $this->factory->xprofile_group->create();
     599                $parent = $this->factory->xprofile_field->create( array(
     600                        'field_group_id' => $g,
     601                        'type' => 'selectbox',
     602                        'name' => 'Parent',
     603                ) );
     604
     605                $f = xprofile_insert_field( array(
     606                        'field_group_id' => $g,
     607                        'parent_id' => $parent,
     608                        'type' => 'option',
     609                        'name' => 'Option 1',
     610                        'option_order' => 5,
     611                ) );
     612
     613                $field = new BP_XProfile_Field( $f );
     614
     615                $this->assertEquals( 5, $field->option_order );
     616        }
    593617}
Note: See TracChangeset for help on using the changeset viewer.