Ticket #7112: 7112.01.patch
File 7112.01.patch, 1.5 KB (added by , 9 years ago) |
---|
-
src/bp-xprofile/classes/class-bp-xprofile-field.php
943 943 $sql = $wpdb->prepare( "UPDATE {$table_name} SET group_id = %d WHERE parent_id = %d", $field_group_id, $field_id ); 944 944 $wpdb->query( $sql ); 945 945 946 // Invalidate profile field cache. 947 wp_cache_delete( $field_id, 'bp_xprofile_fields' ); 948 946 949 return $parent; 947 950 } 948 951 -
tests/phpunit/testcases/xprofile/class-bp-xprofile-field.php
183 183 184 184 $this->assertFalse( wp_cache_get( 12345, 'bp_xprofile_fields' ) ); 185 185 } 186 187 /** 188 * @ticket BP7112 189 */ 190 public function test_update_position_should_invalidate_cache() { 191 $group = $this->factory->xprofile_group->create(); 192 $field = $this->factory->xprofile_field->create( array( 193 'field_group_id' => $group, 194 ) ); 195 196 // Prime cache. 197 xprofile_get_field( $field ); 198 199 // Update field position. 200 BP_XProfile_Field::update_position( $field, 12345, 12345 ); 201 202 // Fetch cache after position update. 203 $cached = wp_cache_get( $field, 'bp_xprofile_fields' ); 204 205 // Cache should be invalidated at this point. 206 $this->assertEmpty( $cached ); 207 } 186 208 }