- Timestamp:
- 01/19/2023 09:46:58 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r54891 r55102 2826 2826 } 2827 2827 2828 public function additional_field_get_callback( $object, $field_name ) { 2829 return get_user_meta( $object['id'], $field_name, true ); 2830 } 2831 2832 public function additional_field_update_callback( $value, $user, $field_name ) { 2833 if ( 'returnError' === $value ) { 2834 return new WP_Error( 'rest_invalid_param', 'Testing an error.', array( 'status' => 400 ) ); 2835 } 2836 update_user_meta( $user->ID, $field_name, $value ); 2837 } 2838 2828 2839 /** 2829 2840 * @ticket 39701 … … 3073 3084 } 3074 3085 3075 public function additional_field_get_callback( $object ) {3076 return get_user_meta( $object['id'], 'my_custom_int', true );3077 }3078 3079 public function additional_field_update_callback( $value, $user ) {3080 if ( 'returnError' === $value ) {3081 return new WP_Error( 'rest_invalid_param', 'Testing an error.', array( 'status' => 400 ) );3082 }3083 update_user_meta( $user->ID, 'my_custom_int', $value );3084 }3085 3086 3086 protected function check_user_data( $user, $data, $context, $links ) { 3087 3087 $this->assertSame( $user->ID, $data['id'] );
Note: See TracChangeset
for help on using the changeset viewer.