Skip to content

Commit 99f1c3a

Browse files
committed
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>
1 parent 688e956 commit 99f1c3a

File tree

3 files changed

+646
-1537
lines changed

3 files changed

+646
-1537
lines changed

tests/acceptance/bootstrap/OcisConfigContext.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,37 @@ public function theAdministratorHasEnabledTheRole(string $role): void {
120120
$this->setEnabledPermissionsRoles($defaultRoles);
121121
}
122122

123+
/**
124+
* @Given the administrator has enabled the following share permissions roles:
125+
*
126+
* @param TableNode $table
127+
*
128+
* @return void
129+
*/
130+
public function theAdministratorHasEnabledTheFollowingShareRoles(TableNode $table): void {
131+
$defaultRoles = array_values(GraphHelper::DEFAULT_PERMISSIONS_ROLES);
132+
$roles = [];
133+
foreach ($table->getHash() as $row) {
134+
$roles[] = $row['role'];
135+
$roleId = GraphHelper::getPermissionsRoleIdByName($row['role']);
136+
if (!\in_array($roleId, $defaultRoles)) {
137+
$defaultRoles[] = $roleId;
138+
}
139+
}
140+
141+
$envs = [
142+
"GRAPH_AVAILABLE_ROLES" => implode(',', $defaultRoles),
143+
];
144+
$response = OcisConfigHelper::reConfigureOcis($envs);
145+
146+
Assert::assertEquals(
147+
200,
148+
$response->getStatusCode(),
149+
"Failed to enable roles: " . implode(', ', $roles)
150+
);
151+
$this->setEnabledPermissionsRoles($defaultRoles);
152+
}
153+
123154
/**
124155
* @Given the administrator has disabled the permissions role :role
125156
*

0 commit comments

Comments
 (0)