Added test for sending share invitation to wrong objectId

This commit is contained in:
Prarup Gurung
2024-01-25 14:13:46 +05:45
parent 18a62b5133
commit 2675e739b2
2 changed files with 64 additions and 9 deletions
@@ -156,16 +156,20 @@ class SharingNgContext implements Context {
: $this->spacesContext->getFileId($user, $rows['space'], $rows['resource']);
}
$sharees = array_map('trim', explode(',', $rows['sharee']));
$shareTypes = array_map('trim', explode(',', $rows['shareType']));
if (\array_key_exists('shareeId', $rows)) {
$shareeIds[] = $rows['shareeId'];
$shareTypes[] = $rows['shareType'];
} else {
$sharees = array_map('trim', explode(',', $rows['sharee']));
$shareTypes = array_map('trim', explode(',', $rows['shareType']));
$shareeIds = [];
foreach ($sharees as $index => $sharee) {
$shareType = $shareTypes[$index];
// for non-exiting group or user, generate random id
$shareeIds[] = (($shareType === 'user')
? $this->featureContext->getAttributeOfCreatedUser($sharee, 'id')
: $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id')) ?: WebDavHelper::generateUUIDv4();
foreach ($sharees as $index => $sharee) {
$shareType = $shareTypes[$index];
// for non-exiting group or user, generate random id
$shareeIds[] = (($shareType === 'user')
? $this->featureContext->getAttributeOfCreatedUser($sharee, 'id')
: $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id')) ?: WebDavHelper::generateUUIDv4();
}
}
$permissionsRole = $rows['permissionsRole'] ?? null;
@@ -208,6 +212,7 @@ class SharingNgContext implements Context {
/**
* @When /^user "([^"]*)" sends the following share invitation using the Graph API:$/
* @When /^user "([^"]*)" tries to send the following share invitation using the Graph API:$/
*
* @param string $user
* @param TableNode $table