diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index e5d7f699f189..09a7ff52bd50 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -814,6 +814,43 @@ public function resetOldLdapConfig() { } } + /** + * This function will allow us to manually add skeleton files + * + * @param array $usersAttributes + * + * @return void + * @throws Exception + */ + public function manuallyAddSkeletonFiles($usersAttributes) { + $skeletonDir = \getenv("SKELETON_DIR"); + $revaRoot = \getenv("OCIS_REVA_DATA_ROOT"); + if (!$skeletonDir) { + throw new Exception('Missing SKELETON_DIR environment variable, cannot copy skeleton files for OCIS'); + } + if (!$revaRoot && OcisHelper::getDeleteUserDataCommand() !== false) { + foreach ($usersAttributes as $userAttributes) { + OcisHelper::recurseUpload( + $this->getBaseUrl(), + $skeletonDir, + $userAttributes['userid'], + $userAttributes['password'] + ); + } + } elseif (!$revaRoot) { + throw new Exception('Missing OCIS_REVA_DATA_ROOT environment variable, cannot copy skeleton files for OCIS'); + } else { + foreach ($usersAttributes as $userAttributes) { + $user = $userAttributes['userid']; + $dataDir = $revaRoot . "data/$user/files"; + if (!\file_exists($dataDir)) { + \mkdir($dataDir, 0777, true); + } + OcisHelper::recurseCopy($skeletonDir, $dataDir); + } + } + } + /** * This function will allow us to send user creation requests in parallel. * This will be faster in comparison to waiting for each request to complete before sending another request. @@ -1202,11 +1239,7 @@ public function adminSendsUserCreationRequestUsingTheProvisioningApi($user, $pas $setting["password"] = $password; $setting["email"] = $email; \array_push($settings, $setting); - $this->usersHaveBeenCreated( - true, - $settings, - 'api' - ); + $this->manuallyAddSkeletonFiles($settings); } else { $this->addUserToCreatedUsersList($user, $password); }