Changeset 9983
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php
r9879 r9983 288 288 if ( $wpdb->query( $sql ) !== null ) { 289 289 290 if ( ! empty( $this->id ) ) {290 if ( ! empty( $this->id ) ) { 291 291 $field_id = $this->id; 292 292 } else { … … 382 382 $this->type_obj->field_obj = $this; 383 383 384 return $field_id; 384 // If this is a new field, set the `id` property of the current object. 385 if ( empty( $this->id ) ) { 386 $this->id = $field_id; 387 } 388 389 return $this->id; 385 390 } else { 386 391 return false; -
trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-field.php
r9878 r9983 109 109 ); 110 110 } 111 112 /** 113 * @ticket BP6545 114 */ 115 public function test_newly_created_field_should_have_field_id_property_set() { 116 $field = new BP_XProfile_Field(); 117 $field->group_id = 1; 118 $field->name = 'Foo'; 119 120 $new_field_id = $field->save(); 121 122 $this->assertSame( $new_field_id, $field->id ); 123 } 111 124 }
Note: See TracChangeset
for help on using the changeset viewer.