check email in the search sharee request (#8861)

This commit is contained in:
Viktor Scharf
2024-04-17 11:42:09 +02:00
committed by GitHub
parent 0972b7cc12
commit b51ba47e01
6 changed files with 1087 additions and 1001 deletions
@@ -2624,4 +2624,27 @@ class GraphContext implements Context {
$this->featureContext->getJSONSchema($schemaString)
);
}
/**
* @Then the JSON data of the search response should not contain user(s) email
*
* @return void
* @throws Exception
*/
public function theJsonDataResponseShouldNotContainUserEmail(): void {
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent()->value;
$mailValueExist = false;
$email = "";
foreach ($responseBody as $value) {
if (isset($value->mail)) {
$mailValueExist = true;
$email = $value->mail;
break;
}
}
Assert::assertFalse(
$mailValueExist,
"Response contains email '$email' but should not."
);
}
}