[test-only] ApiTest. Disable/enable user (#5639)

This commit is contained in:
Viktor Scharf
2023-03-06 16:52:55 +05:45
committed by GitHub
parent 1c88d445bd
commit 1e1b4379ae
9 changed files with 286 additions and 65 deletions
+11 -3
View File
@@ -171,6 +171,7 @@ class GraphHelper {
* @param string|null $password
* @param string|null $email
* @param string|null $displayName
* @param bool|true $accountEnabled
*
* @return ResponseInterface
* @throws GuzzleException
@@ -184,13 +185,15 @@ class GraphHelper {
?string $userName = null,
?string $password = null,
?string $email = null,
?string $displayName = null
?string $displayName = null,
?bool $accountEnabled = true
): ResponseInterface {
$payload = self::preparePatchUserPayload(
$userName,
$password,
$email,
$displayName
$displayName,
$accountEnabled
);
$url = self::getFullUrl($baseUrl, 'users/' . $userId);
return HttpRequestHelper::sendRequest(
@@ -639,6 +642,7 @@ class GraphHelper {
if (!empty($email)) {
$payload['mail'] = $email ?? $userName . '@example.com';
}
$payload['accountEnabled'] = true;
return \json_encode($payload);
}
@@ -649,6 +653,7 @@ class GraphHelper {
* @param string|null $password
* @param string|null $email
* @param string|null $displayName
* @param bool|true $accountEnabled
*
* @return string
*/
@@ -656,7 +661,8 @@ class GraphHelper {
?string $userName,
?string $password,
?string $email,
?string $displayName
?string $displayName,
?bool $accountEnabled
): string {
$payload = [];
if ($userName) {
@@ -671,6 +677,8 @@ class GraphHelper {
if ($email) {
$payload['mail'] = $email;
}
$payload['accountEnabled'] = $accountEnabled;
return \json_encode($payload);
}