Only validate changed user fields when provided#118
Conversation
|
@MagnusSamuelsson Thanks for working on fixing the issue. Can you please add automated tests to support your change? |
|
@dmitriim Sure! Maybe also one or two tests that updates a singlefield? But I think that's redundant. About empty/isset. We need too stick with isset, or make additional checks. With !empty, it will skip validation, and update it even if it's set to an empty string. Speaking of... That's something we can test to assure that never happens. |
|
As there is a bug I'd suggest to take following approach.
|
7df237f to
e4f2872
Compare
|
@dmitriim |
| * Test that a user can be updated without providing any other fields than the mappingfield. | ||
| * (Only auth field should be updated). | ||
| */ | ||
| public function test_update_allow_unset_fields(): void { |
There was a problem hiding this comment.
Would be nice to add tests that would cover the error that you're trying to solve when email or/and username is not set in update user request.
Added a check before validation, so validation won't happen if there is nothing to validate (and update)