@@ -16,17 +16,14 @@ class GroupfoldersContext implements Context {
1616 /** @var array<mixed> */
1717 private array $ createdGroupFolders = [];
1818
19- /**
20- * @var string|null
21- */
22- private ?string $ groupfolderDavPath = null ;
2319
2420 /**
2521 * @Given group folder :folderName has been created
2622 */
2723 public function groupFolderHasBeenCreated (string $ folderName ): void {
2824 $ fullUrl = $ this ->featureContext ->getBaseUrl () .
29- $ this ->getGroupfolderDavPath () . "apps/groupfolders/folders " ;
25+ "index.php/apps/groupfolders/folders " ;
26+
3027 $ headers ['OCS-APIRequest ' ] = 'true ' ;
3128 $ options = [
3229 'multipart ' => [
@@ -57,7 +54,7 @@ public function groupFolderHasBeenCreated(string $folderName): void {
5754 public function groupHasBeenAddedToGroupFolder (string $ group , string $ groupfolder ):void {
5855 $ groupfolderId = $ this ->createdGroupFolders [$ groupfolder ];
5956 $ fullUrl = $ this ->featureContext ->getBaseUrl () .
60- $ this -> getGroupfolderDavPath (). " apps/groupfolders/folders/ " .$ groupfolderId . "/groups " ;
57+ " index.php/ apps/groupfolders/folders/ " .$ groupfolderId . "/groups " ;
6158 $ headers ['OCS-APIRequest ' ] = 'true ' ;
6259 $ options = [
6360 'multipart ' => [
@@ -161,7 +158,7 @@ private function getGroupfolderByMountpoint(string $mountpoint): array {
161158 */
162159 private function getAllGroupfolders () {
163160 $ fullUrl = $ this ->featureContext ->getBaseUrl () .
164- $ this -> getGroupfolderDavPath (). " apps/groupfolders/folders?format=json " ;
161+ " index.php/ apps/groupfolders/folders?format=json " ;
165162
166163 $ headers ['Content-Type ' ] = 'application/json ' ;
167164 $ headers ['OCS-APIRequest ' ] = 'true ' ;
@@ -181,7 +178,7 @@ private function getAllGroupfolders() {
181178
182179 private function adminDeletesGroupfolder (int $ id ): void {
183180 $ fullUrl = $ this ->featureContext ->getBaseUrl () .
184- $ this -> getGroupfolderDavPath (). " apps/groupfolders/folders/ " . $ id ;
181+ " index.php/ apps/groupfolders/folders/ " . $ id ;
185182 $ headers ['OCS-APIRequest ' ] = 'true ' ;
186183 $ this ->featureContext ->sendHttpRequest (
187184 $ fullUrl ,
@@ -192,29 +189,6 @@ private function adminDeletesGroupfolder(int $id): void {
192189 );
193190 }
194191
195- /**
196- * @return string
197- * @throws GuzzleException
198- */
199- private function getGroupfolderDavPath (): string {
200- // groupfolder with version greater than or equals to 19.0.0 uses "ocs/v2.php/" endpoint
201- if ($ this ->groupfolderDavPath !== null ) {
202- return $ this ->groupfolderDavPath ;
203- }
204- $ capabilitiesResponse = $ this ->featureContext ->sendOCSRequest (
205- '/cloud/capabilities ' , 'GET ' , $ this ->featureContext ->getAdminUsername ()
206- );
207- $ this ->featureContext ->theHTTPStatusCodeShouldBe (200 , "" , $ capabilitiesResponse );
208- $ responseAsJson = json_decode ($ capabilitiesResponse ->getBody ()->getContents ());
209- $ groupFolderVersion = $ responseAsJson ->ocs ->data ->capabilities ->integration_openproject ->groupfolder_version ?? null ;
210- Assert::assertNotNull ($ groupFolderVersion , 'Group folder version not found in the response ' );
211- if (version_compare ($ groupFolderVersion , '19 ' ) >= 0 ) {
212- return $ this ->groupfolderDavPath = "ocs/v2.php/ " ;
213- }
214- return $ this ->groupfolderDavPath = "index.php/ " ;
215- }
216-
217-
218192 /**
219193 * This will run before EVERY scenario.
220194 * It will set the properties for this object.
0 commit comments