fix after review

This commit is contained in:
Viktor Scharf
2022-02-11 10:43:42 +01:00
parent 85714c113d
commit 493ec780f0
2 changed files with 10 additions and 7 deletions
@@ -45,7 +45,7 @@ Feature: Share spaces
Given user "Alice" has created a space "Share space to Brian" of type "project" with quota "10"
And user "Alice" has shared a space "Share space to Brian" to user "Brian" with role "viewer"
When user "Alice" lists all available spaces via the GraphApi
And the json responded should contain a space "Share space to Brian" granted to "Brian" with these key and value pairs:
Then the json responded should contain a space "Share space to Brian" granted to "Brian" with these key and value pairs:
| key | value |
| root@@@permissions@@@1@@@grantedTo@@@0@@@user@@@id | %user_id% |
| root@@@permissions@@@1@@@roles@@@0 | viewer |
@@ -227,8 +227,11 @@ class SpacesContext implements Context {
);
if ($this->featureContext->getResponse()) {
$rawBody = $this->featureContext->getResponse()->getBody()->getContents();
if (isset(\json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["accounts"])) {
$accounts = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR)["accounts"];
$response = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR);
if (isset($response["accounts"])) {
$accounts = $response["accounts"];
} else {
throw new Exception(__METHOD__ . " accounts-list is empty");
}
}
foreach ($accounts as $account) {
@@ -1530,7 +1533,7 @@ class SpacesContext implements Context {
*
* @param string $user
* @param string $spaceName
* @param string $userWithManagerRigths
* @param string $userWithManagerRights
*
* @return void
* @throws GuzzleException
@@ -1538,10 +1541,10 @@ class SpacesContext implements Context {
public function sendRestoreSpaceRequest(
string $user,
string $spaceName,
string $userWithManagerRigths = ''
string $userWithManagerRights = ''
): void {
if (!empty($userWithManagerRigths)) {
$space = $this->getSpaceByName($userWithManagerRigths, $spaceName);
if (!empty($userWithManagerRights)) {
$space = $this->getSpaceByName($userWithManagerRights, $spaceName);
} else {
$space = $this->getSpaceByName($user, $spaceName);
}