test: refactor additional share role test scenarios

Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>

test: refactor additional share role test scenarios

Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
This commit is contained in:
Saw-jan committed 2025-06-30 13:00:12 +05:45
1 parent 688e956eeb
commit 99f1c3a42f
3 files changed
+779 -1670

No files matched your search

@@ -120,6 +120,37 @@ class OcisConfigContext implements Context {
$this->setEnabledPermissionsRoles($defaultRoles);
}
/**
* @Given the administrator has enabled the following share permissions roles:
*
* @param TableNode $table
*
* @return void
*/
public function theAdministratorHasEnabledTheFollowingShareRoles(TableNode $table): void {
$defaultRoles = array_values(GraphHelper::DEFAULT_PERMISSIONS_ROLES);
$roles = [];
foreach ($table->getHash() as $row) {
$roles[] = $row['role'];
$roleId = GraphHelper::getPermissionsRoleIdByName($row['role']);
if (!\in_array($roleId, $defaultRoles)) {
$defaultRoles[] = $roleId;
}
}
$envs = [
"GRAPH_AVAILABLE_ROLES" => implode(',', $defaultRoles),
];
$response = OcisConfigHelper::reConfigureOcis($envs);
Assert::assertEquals(
200,
$response->getStatusCode(),
"Failed to enable roles: " . implode(', ', $roles)
);
$this->setEnabledPermissionsRoles($defaultRoles);
}
/**
* @Given the administrator has disabled the permissions role :role
*
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff