Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/28/2016 12:09:14 PM (8 years ago)
Author:
djpaul
Message:

xprofile: fix valueless datebox profile fields erroneously returning the unix epoch.

Fixes #7351

Props nickmomrik

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-field.php

    r10877 r11253  
    205205        $this->assertEquals( $new_field_order, $updated_fetched_field->field_order );
    206206    }
     207
     208    /**
     209     * @ticket BP7351
     210     */
     211    public function test_empty_datebox_fields_should_not_return_unix_epoch() {
     212        $user  = $this->factory->user->create( array( 'role' => 'subscriber' ) );
     213        $group = $this->factory->xprofile_group->create();
     214        $field = $this->factory->xprofile_field->create( array(
     215            'field_group_id' => $group,
     216            'type' => 'datebox',
     217        ) );
     218
     219        $old_user = get_current_user_id();
     220        $this->set_current_user( $user );
     221
     222        $value = bp_get_profile_field_data( array( 'user_id' => $user, 'field' => $field ) );
     223        $this->assertEmpty( $value );
     224
     225        $this->set_current_user( $old_user );
     226    }
    207227}
Note: See TracChangeset for help on using the changeset viewer.