$request_options[RequestOptions::BODY
] =
$this->serializer->
encode($normalization,
static::
$format);
// DX: 422 when changing email while providing a wrong password.
$response =
$this->
request('PATCH',
$url,
$request_options);
$this->
assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\nmail: Your current password is missing or incorrect; it's required to change the Email.\n",
$response, FALSE, FALSE, FALSE, FALSE
);
$normalization['pass'
] =
[['existing' =>
$this->account->passRaw
]];
$request_options[RequestOptions::BODY
] =
$this->serializer->
encode($normalization,
static::
$format);
// 200 for well-formed request.
$response =
$this->
request('PATCH',
$url,
$request_options);
$this->
assertResourceResponse(200, FALSE,
$response);
// Test case 2: changing password.
$normalization =
$original_normalization;
$new_password =
$this->
randomString();
$normalization['pass'
] =
[['value' =>
$new_password]];
$request_options[RequestOptions::BODY
] =
$this->serializer->
encode($normalization,
static::
$format);
// DX: 422 when changing password without providing the current password.
$response =
$this->
request('PATCH',
$url,
$request_options);
$this->
assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\npass: Your current password is missing or incorrect; it's required to change the Password.\n",
$response, FALSE, FALSE, FALSE, FALSE
);