From 6615cf4c56493f519410f7dd11717e983e237442 Mon Sep 17 00:00:00 2001 From: Parajuli Kiran Date: Fri, 22 Apr 2022 14:19:55 +0545 Subject: [PATCH 1/2] Improve then steps for suite 'apiFederationToShares2' Signed-off-by: Parajuli Kiran --- .../apiFederationToShares2/federated.feature | 242 ++++++++++++------ .../accessToSharesFolder.feature | 2 +- .../bootstrap/AppConfigurationContext.php | 20 ++ .../features/bootstrap/FeatureContext.php | 20 +- .../features/bootstrap/FederationContext.php | 9 +- .../features/bootstrap/OCSContext.php | 1 + .../acceptance/features/bootstrap/Sharing.php | 2 + .../acceptance/features/bootstrap/WebDav.php | 28 +- 8 files changed, 238 insertions(+), 86 deletions(-) diff --git a/tests/acceptance/features/apiFederationToShares2/federated.feature b/tests/acceptance/features/apiFederationToShares2/federated.feature index 031aa3709b62..4ce131b81f5e 100644 --- a/tests/acceptance/features/apiFederationToShares2/federated.feature +++ b/tests/acceptance/features/apiFederationToShares2/federated.feature @@ -11,7 +11,7 @@ Feature: federated And auto-accept shares has been disabled And user "Brian" has been created with default attributes and without skeleton files - @issue-35839 @skipOnOcV10 + Scenario: "Auto accept from trusted servers" enabled with remote server Given using server "REMOTE" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile1.txt" @@ -20,11 +20,13 @@ Feature: federated And parameter "auto_accept_trusted" of app "federatedfilesharing" has been set to "yes" When the administrator adds url "%remote_server%" as trusted server using the testing API And user "Alice" from server "REMOTE" shares "/textfile1.txt" with user "Brian" from server "LOCAL" using the sharing API - And using server "LOCAL" + Then the OCS status code should be "100" + And the HTTP status code of responses on each endpoint should be "201, 200" respectively + When using server "LOCAL" Then as "Brian" file "Shares/textfile1.txt" should exist And url "%remote_server%" should be a trusted server - @issue-35839 @skipOnOcV10 + Scenario: "Auto accept from trusted servers" disabled with remote server Given using server "REMOTE" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile1.txt" @@ -33,10 +35,13 @@ Feature: federated And parameter "auto_accept_trusted" of app "federatedfilesharing" has been set to "no" When the administrator adds url "%remote_server%" as trusted server using the testing API And user "Alice" from server "REMOTE" shares "/textfile1.txt" with user "Brian" from server "LOCAL" using the sharing API - And using server "LOCAL" + Then the OCS status code should be "100" + And the HTTP status code of responses on each endpoint should be "201, 200" respectively + When using server "LOCAL" Then as "Brian" file "Shares/textfile1.txt" should not exist And url "%remote_server%" should be a trusted server + Scenario: Federated share with "Auto add server" enabled Given the trusted server list is cleared And using server "LOCAL" @@ -44,11 +49,14 @@ Feature: federated And using server "REMOTE" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile1.txt" When user "Alice" from server "REMOTE" shares "/textfile1.txt" with user "Brian" from server "LOCAL" using the sharing API - And user "Brian" from server "LOCAL" has accepted the last pending share - And using server "LOCAL" + And user "Brian" from server "LOCAL" accepts the last pending share using the sharing API + Then the HTTP status code of responses on all endpoints should be 200 + And the OCS status code of responses on all endpoints should be "100" + When using server "LOCAL" Then as "Brian" file "Shares/textfile1.txt" should exist And url "%remote_server%" should be a trusted server + Scenario: Federated share with "Auto add server" disabled Given using server "REMOTE" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile1.txt" @@ -56,11 +64,14 @@ Feature: federated And the trusted server list is cleared And parameter "autoAddServers" of app "federation" has been set to "0" When user "Alice" from server "REMOTE" shares "/textfile1.txt" with user "Brian" from server "LOCAL" using the sharing API - And user "Brian" from server "LOCAL" has accepted the last pending share - And using server "LOCAL" + And user "Brian" from server "LOCAL" accepts the last pending share using the sharing API + Then the HTTP status code of responses on all endpoints should be 200 + And the OCS status code of responses on all endpoints should be "100" + When using server "LOCAL" Then as "Brian" file "Shares/textfile1.txt" should exist And url "%remote_server%" should not be a trusted server + @issue-35839 @skipOnOcV10 Scenario: enable "Add server automatically" once a federated share was created successfully Given using server "REMOTE" @@ -70,13 +81,17 @@ Feature: federated And parameter "autoAddServers" of app "federation" has been set to "1" And parameter "auto_accept_trusted" of app "federatedfilesharing" has been set to "yes" When user "Alice" from server "REMOTE" shares "/textfile0.txt" with user "Brian" from server "LOCAL" using the sharing API - And user "Brian" from server "LOCAL" has accepted the last pending share - And using server "LOCAL" + And user "Brian" from server "LOCAL" accepts the last pending share using the sharing API + Then the HTTP status code of responses on all endpoints should be 200 + And the OCS status code of responses on all endpoints should be "100" + When using server "LOCAL" Then url "%remote_server%" should be a trusted server When user "Alice" from server "REMOTE" shares "/textfile1.txt" with user "Brian" from server "LOCAL" using the sharing API + Then the HTTP status code should be "200" + And the OCS status code should be "100" Then as "Brian" file "Shares/textfile1.txt" should exist - @issue-35839 @skipOnOcV10 + Scenario: disable "Add server automatically" once a federated share was created successfully Given using server "REMOTE" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile0.txt" @@ -86,12 +101,17 @@ Feature: federated And parameter "autoAddServers" of app "federation" has been set to "0" And parameter "auto_accept_trusted" of app "federatedfilesharing" has been set to "yes" When user "Alice" from server "REMOTE" shares "/textfile0.txt" with user "Brian" from server "LOCAL" using the sharing API - And user "Brian" from server "LOCAL" has accepted the last pending share - And using server "LOCAL" + And user "Brian" from server "LOCAL" accepts the last pending share using the sharing API + Then the HTTP status code of responses on all endpoints should be 200 + And the OCS status code of responses on all endpoints should be "100" + When using server "LOCAL" Then url "%remote_server%" should not be a trusted server When user "Alice" from server "REMOTE" shares "/textfile1.txt" with user "Brian" from server "LOCAL" using the sharing API + Then the HTTP status code should be "200" + And the OCS status code should be "100" And as "Brian" file "Shares/textfile1.txt" should not exist + Scenario Outline: federated share receiver sees the original content of a received file Given using server "REMOTE" And user "Alice" has uploaded file with content "thisContentIsVisible" to "/file-to-share" @@ -105,6 +125,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: federated share receiver sees the original content of a received file in multiple levels of folders Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -120,6 +141,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: remote federated share receiver adds files/folders in the federated share Given user "Brian" has created folder "/PARENT" And user "Brian" has created folder "/PARENT/RandomFolder" @@ -130,7 +152,8 @@ Feature: federated And using server "REMOTE" When user "Alice" uploads file with content "thisContentIsFinal" to "/Shares/RandomFolder/new-file" using the WebDAV API And user "Alice" creates folder "/Shares/RandomFolder/sub-folder" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code of responses on all endpoints should be 201 + When using server "LOCAL" Then as "Brian" file "/PARENT/RandomFolder/new-file" should exist And as "Brian" file "/PARENT/RandomFolder/file-to-share" should exist And as "Brian" folder "/PARENT/RandomFolder/sub-folder" should exist @@ -140,6 +163,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: local federated share receiver adds files/folders in the federated share Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -151,7 +175,8 @@ Feature: federated And using server "LOCAL" When user "Brian" uploads file with content "thisContentIsFinal" to "/Shares/RandomFolder/new-file" using the WebDAV API And user "Brian" creates folder "/Shares/RandomFolder/sub-folder" using the WebDAV API - And using server "REMOTE" + Then the HTTP status code of responses on all endpoints should be 201 + When using server "REMOTE" Then as "Alice" file "/PARENT/RandomFolder/new-file" should exist And as "Alice" file "/PARENT/RandomFolder/file-to-share" should exist And as "Alice" folder "/PARENT/RandomFolder/sub-folder" should exist @@ -161,6 +186,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: local federated share receiver deletes files/folders of the received share Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -173,7 +199,8 @@ Feature: federated And using server "LOCAL" When user "Brian" deletes folder "/Shares/RandomFolder/sub-folder" using the WebDAV API And user "Brian" deletes file "/Shares/RandomFolder/file-to-share" using the WebDAV API - And using server "REMOTE" + Then the HTTP status code of responses on all endpoints should be 204 + When using server "REMOTE" Then as "Alice" file "/PARENT/RandomFolder/file-to-share" should not exist And as "Alice" folder "/PARENT/RandomFolder/sub-folder" should not exist But as "Alice" folder "/PARENT/RandomFolder" should exist @@ -182,6 +209,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: remote federated share receiver deletes files/folders of the received share Given user "Brian" has created folder "/PARENT" And user "Brian" has created folder "/PARENT/RandomFolder" @@ -193,7 +221,8 @@ Feature: federated And using server "REMOTE" When user "Alice" deletes folder "/Shares/RandomFolder/sub-folder" using the WebDAV API And user "Alice" deletes file "/Shares/RandomFolder/file-to-share" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code of responses on all endpoints should be 204 + When using server "LOCAL" Then as "Brian" file "/PARENT/RandomFolder/file-to-share" should not exist And as "Brian" folder "/PARENT/RandomFolder/sub-folder" should not exist But as "Brian" folder "/PARENT/RandomFolder" should exist @@ -202,6 +231,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: local federated share receiver renames files/folders of the received share Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -214,7 +244,8 @@ Feature: federated And using server "LOCAL" When user "Brian" moves folder "/Shares/RandomFolder/sub-folder" to "/Shares/RandomFolder/renamed-sub-folder" using the WebDAV API And user "Brian" moves file "/Shares/RandomFolder/file-to-share" to "/Shares/RandomFolder/renamedFile" using the WebDAV API - And using server "REMOTE" + Then the HTTP status code of responses on all endpoints should be 201 + When using server "REMOTE" Then as "Alice" file "/PARENT/RandomFolder/file-to-share" should not exist But as "Alice" file "/PARENT/RandomFolder/renamedFile" should exist And the content of file "/PARENT/RandomFolder/renamedFile" for user "Alice" should be "thisContentShouldBeVisible" @@ -225,6 +256,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: remote federated share receiver renames files/folders of the received share Given user "Brian" has created folder "/PARENT" And user "Brian" has created folder "/PARENT/RandomFolder" @@ -236,7 +268,8 @@ Feature: federated And using server "REMOTE" When user "Alice" moves folder "/Shares/RandomFolder/sub-folder" to "/Shares/RandomFolder/renamed-sub-folder" using the WebDAV API And user "Alice" moves file "/Shares/RandomFolder/file-to-share" to "/Shares/RandomFolder/renamedFile" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code of responses on all endpoints should be 201 + When using server "LOCAL" Then as "Brian" file "/PARENT/RandomFolder/file-to-share" should not exist But as "Brian" file "/PARENT/RandomFolder/renamedFile" should exist And the content of file "/PARENT/RandomFolder/renamedFile" for user "Brian" should be "thisContentShouldBeVisible" @@ -247,6 +280,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: sharer modifies the share which was shared to the federated share receiver Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -256,13 +290,15 @@ Feature: federated And user "Brian" from server "LOCAL" has accepted the last pending share And using OCS API version "" When user "Alice" uploads file with content "thisContentIsFinal" to "/PARENT/RandomFolder/file-to-share" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code should be "204" + When using server "LOCAL" Then the content of file "/Shares/file-to-share" for user "Brian" should be "thisContentIsFinal" Examples: | ocs-api-version | | 1 | | 2 | + Scenario Outline: sharer adds files/folders in the share which was shared to the federated share receiver Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -273,7 +309,8 @@ Feature: federated And using OCS API version "" When user "Alice" uploads file with content "thisContentIsFinal" to "/PARENT/RandomFolder/new-file" using the WebDAV API And user "Alice" creates folder "/PARENT/RandomFolder/sub-folder" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code of responses on all endpoints should be 201 + When using server "LOCAL" Then as "Brian" file "/Shares/RandomFolder/new-file" should exist And as "Brian" file "/Shares/RandomFolder/file-to-share" should exist And as "Brian" folder "/Shares/RandomFolder/sub-folder" should exist @@ -283,6 +320,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: sharer deletes files/folders of the share which was shared to the federated share receiver Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -294,7 +332,8 @@ Feature: federated And using OCS API version "" When user "Alice" deletes folder "/PARENT/RandomFolder/sub-folder" using the WebDAV API And user "Alice" deletes file "/PARENT/RandomFolder/file-to-share" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code of responses on all endpoints should be 204 + When using server "LOCAL" Then as "Brian" file "/Shares/RandomFolder/file-to-share" should not exist And as "Brian" folder "/Shares/RandomFolder/sub-folder" should not exist But as "Brian" folder "/Shares/RandomFolder" should exist @@ -303,6 +342,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: sharer renames files/folders of the share which was shared to the federated share receiver Given using server "REMOTE" And user "Alice" has created folder "/PARENT" @@ -314,7 +354,8 @@ Feature: federated And using OCS API version "" When user "Alice" moves folder "/PARENT/RandomFolder/sub-folder" to "/PARENT/RandomFolder/renamed-sub-folder" using the WebDAV API And user "Alice" moves file "/PARENT/RandomFolder/file-to-share" to "/PARENT/RandomFolder/renamedFile" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code of responses on all endpoints should be 201 + When using server "LOCAL" Then as "Brian" file "/Shares/RandomFolder/file-to-share" should not exist But as "Brian" file "/Shares/RandomFolder/renamedFile" should exist And the content of file "/Shares/RandomFolder/renamedFile" for user "Brian" should be "thisContentShouldBeVisible" @@ -325,6 +366,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: sharer unshares the federated share and the receiver no longer sees the files/folders Given user "Brian" has created folder "/PARENT" And user "Brian" has created folder "/PARENT/RandomFolder" @@ -333,13 +375,16 @@ Feature: federated And user "Alice" from server "REMOTE" has accepted the last pending share And using OCS API version "" When user "Brian" deletes the last share using the sharing API - And using server "REMOTE" + Then the HTTP status code should be "200" + And the OCS status code should be "" + When using server "REMOTE" Then as "Alice" file "/Shares/RandomFolder/file-to-share" should not exist And as "Alice" folder "/Shares/RandomFolder" should not exist Examples: - | ocs-api-version | - | 1 | - | 2 | + | ocs-api-version | ocs-status-code | + | 1 | 100 | + | 2 | 200 | + Scenario Outline: federated share receiver can move the location of the received share and changes are correctly seen at both ends Given user "Brian" has created folder "/PARENT" @@ -352,12 +397,14 @@ Feature: federated When user "Alice" creates folder "/CHILD" using the WebDAV API And user "Alice" creates folder "/CHILD/newRandomFolder" using the WebDAV API And user "Alice" moves folder "/Shares/RandomFolder" to "/CHILD/newRandomFolder/RandomFolder" using the WebDAV API - Then as "Alice" file "/CHILD/newRandomFolder/RandomFolder/file-to-share" should exist + Then the HTTP status code of responses on all endpoints should be "201" + And as "Alice" file "/CHILD/newRandomFolder/RandomFolder/file-to-share" should exist When using server "LOCAL" Then as "Brian" file "/PARENT/RandomFolder/file-to-share" should exist When user "Brian" uploads file with content "thisIsTheContentOfNewFile" to "/PARENT/RandomFolder/newFile" using the WebDAV API And user "Brian" uploads file with content "theContentIsChanged" to "/PARENT/RandomFolder/file-to-share" using the WebDAV API - And using server "REMOTE" + Then the HTTP status code of responses on each endpoint should be "201, 204" respectively + When using server "REMOTE" Then as "Alice" file "/CHILD/newRandomFolder/RandomFolder/newFile" should exist And the content of file "/CHILD/newRandomFolder/RandomFolder/file-to-share" for user "Alice" should be "theContentIsChanged" Examples: @@ -365,6 +412,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: federated sharer can move the location of the received share and changes are correctly seen at both ends Given user "Brian" has created folder "/PARENT" And user "Brian" has created folder "/PARENT/RandomFolder" @@ -375,12 +423,14 @@ Feature: federated When user "Brian" creates folder "/CHILD" using the WebDAV API And user "Brian" creates folder "/CHILD/newRandomFolder" using the WebDAV API And user "Brian" moves folder "PARENT/RandomFolder" to "/CHILD/newRandomFolder/RandomFolder" using the WebDAV API - Then as "Brian" file "/CHILD/newRandomFolder/RandomFolder/file-to-share" should exist + Then the HTTP status code of responses on all endpoints should be "201" + And as "Brian" file "/CHILD/newRandomFolder/RandomFolder/file-to-share" should exist When using server "REMOTE" Then as "Alice" file "/Shares/RandomFolder/file-to-share" should exist When user "Alice" uploads file with content "thisIsTheContentOfNewFile" to "/Shares/RandomFolder/newFile" using the WebDAV API And user "Alice" uploads file with content "theContentIsChanged" to "/Shares/RandomFolder/file-to-share" using the WebDAV API - And using server "LOCAL" + Then the HTTP status code of responses on each endpoint should be "201, 204" respectively + When using server "LOCAL" Then as "Brian" file "/CHILD/newRandomFolder/RandomFolder/newFile" should exist And the content of file "/CHILD/newRandomFolder/RandomFolder/file-to-share" for user "Brian" should be "theContentIsChanged" Examples: @@ -388,6 +438,7 @@ Feature: federated | 1 | | 2 | + Scenario Outline: Both Incoming and Outgoing federation shares are allowed Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "yes" And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "yes" @@ -395,19 +446,24 @@ Feature: federated And user "Brian" has uploaded file with content "thisContentIsVisible" to "/file-to-share" When user "Brian" from server "LOCAL" shares "file-to-share" with user "Alice" from server "REMOTE" using the sharing API And user "Alice" from server "REMOTE" accepts the last pending share using the sharing API - And using server "REMOTE" + Then the HTTP status code of responses on all endpoints should be "200" + And the OCS status code of responses on all endpoints should be "" + When using server "REMOTE" Then as "Alice" file "/Shares/file-to-share" should exist And the content of file "/Shares/file-to-share" for user "Alice" should be "thisContentIsVisible" When user "Alice" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API And user "Alice" from server "REMOTE" shares "/newFile" with user "Brian" from server "LOCAL" using the sharing API + Then the HTTP status code of responses on each endpoint should be "201, 200" respectively + And the OCS status code of responses on each endpoint should be "" respectively And using server "LOCAL" And user "Brian" from server "LOCAL" accepts the last pending share using the sharing API Then as "Brian" file "/Shares/newFile" should exist And the content of file "/Shares/newFile" for user "Brian" should be "thisFileIsShared" Examples: - | ocs-api-version | - | 1 | - | 2 | + | ocs-api-version | ocs-status-code | + | 1 | 100 | + | 2 | 200 | + Scenario Outline: Incoming federation shares are allowed but outgoing federation shares are restricted Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "yes" @@ -415,18 +471,25 @@ Feature: federated And user "Brian" has uploaded file with content "thisContentIsVisible" to "/file-to-share" And using OCS API version "" When user "Brian" from server "LOCAL" shares "file-to-share" with user "Alice" from server "REMOTE" using the sharing API - And using server "REMOTE" + Then the HTTP status code should be "" + And the OCS status code should be "403" + When using server "REMOTE" Then user "Alice" should not have any pending federated cloud share And as "Alice" file "/Shares/file-to-share" should not exist When user "Alice" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API And user "Alice" from server "REMOTE" shares "/newFile" with user "Brian" from server "LOCAL" using the sharing API - And using server "LOCAL" + Then the HTTP status code of responses on each endpoint should be "201, 200" respectively + And the OCS status code of responses on each endpoint should be "" respectively + When using server "LOCAL" And user "Brian" from server "LOCAL" accepts the last pending share using the sharing API - Then as "Brian" file "/Shares/newFile" should exist + Then the HTTP status code should be "200" + And the OCS status code should be "" + And as "Brian" file "/Shares/newFile" should exist Examples: - | ocs-api-version | - | 1 | - | 2 | + | ocs-api-version | ocs-status-code | http-status-code | + | 1 | 100 | 200 | + | 2 | 200 | 403 | + Scenario Outline: Incoming federation shares are restricted but outgoing federation shares are allowed Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "no" @@ -434,18 +497,25 @@ Feature: federated And user "Brian" has uploaded file with content "thisContentIsVisible" to "/file-to-share" And using OCS API version "" When user "Brian" from server "LOCAL" shares "/file-to-share" with user "Alice" from server "REMOTE" using the sharing API - And using server "REMOTE" + Then the HTTP status code should be "200" + And the OCS status code should be "" + When using server "REMOTE" And user "Alice" from server "REMOTE" accepts the last pending share using the sharing API - Then as "Alice" file "/Shares/file-to-share" should exist + Then the HTTP status code should be "200" + And the OCS status code should be "" + And as "Alice" file "/Shares/file-to-share" should exist When user "Alice" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API And user "Alice" from server "REMOTE" shares "/newFile" with user "Brian" from server "LOCAL" using the sharing API - And using server "LOCAL" + Then the HTTP status code of responses on each endpoint should be "" respectively + And the OCS status code of responses on each endpoint should be "403" respectively + When using server "LOCAL" Then user "Brian" should not have any pending federated cloud share And as "Brian" file "/Shares/newFile" should not exist Examples: - | ocs-api-version | - | 1 | - | 2 | + | ocs-api-version | ocs-status-code | http-status-code | + | 1 | 100 | 201,200 | + | 2 | 200 | 201,403 | + Scenario Outline: Both Incoming and outgoing federation shares are restricted Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "no" @@ -453,18 +523,23 @@ Feature: federated And user "Brian" has uploaded file with content "thisContentIsVisible" to "/file-to-share" And using OCS API version "" When user "Brian" from server "LOCAL" shares "/file-to-share" with user "Alice" from server "REMOTE" using the sharing API - And using server "REMOTE" + Then the HTTP status code should be "" + And the OCS status code should be "403" + When using server "REMOTE" Then user "Alice" should not have any pending federated cloud share And as "Alice" file "/Shares/file-to-share" should not exist When user "Alice" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API And user "Alice" from server "REMOTE" shares "/newFile" with user "Brian" from server "LOCAL" using the sharing API - And using server "LOCAL" + Then the HTTP status code of responses on each endpoint should be "201," respectively + And the OCS status code of responses on each endpoint should be "403" respectively + When using server "LOCAL" Then user "Brian" should not have any pending federated cloud share And as "Brian" file "/Shares/newFile" should not exist Examples: - | ocs-api-version | - | 1 | - | 2 | + | ocs-api-version | http-status-code | + | 1 | 200 | + | 2 | 403 | + Scenario Outline: Incoming and outgoing federation shares are enabled for local server but incoming federation shares are restricted for remote server Given using server "REMOTE" @@ -476,18 +551,25 @@ Feature: federated And user "Brian" has uploaded file with content "thisContentIsVisible" to "/file-to-share" And using OCS API version "" When user "Brian" from server "LOCAL" shares "/file-to-share" with user "Alice" from server "REMOTE" using the sharing API - And using server "REMOTE" + Then the HTTP status code should be "" + And the OCS status code should be "403" + When using server "REMOTE" Then user "Alice" should not have any pending federated cloud share And as "Alice" file "/Shares/file-to-share" should not exist When user "Alice" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API And user "Alice" from server "REMOTE" shares "/newFile" with user "Brian" from server "LOCAL" using the sharing API - And using server "LOCAL" + Then the HTTP status code of responses on each endpoint should be "201,200" respectively + And the OCS status code of responses on each endpoint should be "" respectively + When using server "LOCAL" And user "Brian" from server "LOCAL" accepts the last pending share using the sharing API - Then as "Brian" file "/Shares/newFile" should exist + Then the HTTP status code should be "200" + And the OCS status code should be "" + And as "Brian" file "/Shares/newFile" should exist Examples: - | ocs-api-version | - | 1 | - | 2 | + | ocs-api-version | ocs-status-code | http-status-code | + | 1 | 100 | 200 | + | 2 | 200 | 403 | + Scenario Outline: Incoming and outgoing federation shares are enabled for local server but outgoing federation shares are restricted for remote server Given using server "REMOTE" @@ -499,18 +581,25 @@ Feature: federated And user "Brian" has uploaded file with content "thisContentIsVisible" to "/file-to-share" And using OCS API version "" When user "Brian" from server "LOCAL" shares "/file-to-share" with user "Alice" from server "REMOTE" using the sharing API - And using server "REMOTE" + Then the HTTP status code should be "200" + And the OCS status code should be "" + When using server "REMOTE" And user "Alice" from server "REMOTE" accepts the last pending share using the sharing API - Then as "Alice" file "/Shares/file-to-share" should exist + Then the HTTP status code should be "200" + And the OCS status code should be "" + And as "Alice" file "/Shares/file-to-share" should exist When user "Alice" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API And user "Alice" from server "REMOTE" shares "/newFile" with user "Brian" from server "LOCAL" using the sharing API - And using server "LOCAL" + Then the HTTP status code of responses on each endpoint should be "" respectively + And the OCS status code of responses on each endpoint should be "403" respectively + When using server "LOCAL" Then user "Brian" should not have any pending federated cloud share And as "Brian" file "/Shares/newFile" should not exist Examples: - | ocs-api-version | - | 1 | - | 2 | + | ocs-api-version | ocs-status-code | http-status-code | + | 1 | 100 | 201,200 | + | 2 | 200 | 201,403 | + @skipOnOcV10.3 @skipOnOcV10.4 @skipOnOcV10.5.0 Scenario Outline: Federated share a file with another server with expiration date @@ -544,6 +633,7 @@ Feature: federated | 1 | 100 | | 2 | 200 | + @skipOnOcV10.3 @skipOnOcV10.4 @skipOnOcV10.5.0 Scenario Outline: Federated sharing with default expiration date enabled but not enforced, user shares without specifying expireDate Given using OCS API version "" @@ -559,6 +649,7 @@ Feature: federated | 1 | 100 | # | 2 | 200 | + @skipOnOcV10.3 @skipOnOcV10.4 @skipOnOcV10.5.0 Scenario Outline: Federated sharing with default expiration date enabled and enforced, user shares without specifying expireDate Given using OCS API version "" @@ -575,6 +666,7 @@ Feature: federated | 1 | 100 | | 2 | 200 | + @skipOnOcV10.3 @skipOnOcV10.4 @skipOnOcV10.5.0 Scenario Outline: Federated sharing with default expiration date disabled Given using OCS API version "" @@ -590,6 +682,7 @@ Feature: federated | 1 | 100 | | 2 | 200 | + @skipOnOcV10.3 @skipOnOcV10.4 @skipOnOcV10.5.0 Scenario Outline: Expiration date is enforced for federated share, user modifies expiration date Given using OCS API version "" @@ -597,8 +690,8 @@ Feature: federated And parameter "shareapi_enforce_expire_date_remote_share" of app "core" has been set to "yes" And parameter "shareapi_expire_after_n_days_remote_share" of app "core" has been set to "7" And user "Brian" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" - When user "Brian" from server "LOCAL" shares "/textfile0.txt" with user "Alice" from server "REMOTE" using the sharing API - And user "Brian" updates the last share using the sharing API with + And user "Brian" from server "LOCAL" has shared "/textfile0.txt" with user "Alice" from server "REMOTE" + When user "Brian" updates the last share using the sharing API with | expireDate | +3 days | Then the OCS status code should be "" And the HTTP status code should be "200" @@ -609,15 +702,16 @@ Feature: federated | 1 | 100 | | 2 | 200 | + @skipOnOcV10.3 @skipOnOcV10.4 @skipOnOcV10.5.0 - Scenario Outline: Federated sharing with default expiration date enabled and enforced, user shares with expiration date more than the default + Scenario Outline: Federated sharing with default expiration date enabled and enforced, user updates the share with expiration date more than the default Given using OCS API version "" And parameter "shareapi_default_expire_date_remote_share" of app "core" has been set to "yes" And parameter "shareapi_enforce_expire_date_remote_share" of app "core" has been set to "yes" And parameter "shareapi_expire_after_n_days_remote_share" of app "core" has been set to "7" And user "Brian" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" - When user "Brian" from server "LOCAL" shares "/textfile0.txt" with user "Alice" from server "REMOTE" using the sharing API - And user "Brian" updates the last share using the sharing API with + And user "Brian" from server "LOCAL" has shared "/textfile0.txt" with user "Alice" from server "REMOTE" + When user "Brian" updates the last share using the sharing API with | expireDate | +10 days | Then the OCS status code should be "404" And the HTTP status code should be "" @@ -627,6 +721,7 @@ Feature: federated | 1 | 200 | | 2 | 404 | + @skipOnOcV10.6 @skipOnOcV10.7 @skipOnOcV10.8.0 Scenario Outline: User modifies expiration date for federated reshare of a file with another server with default expiration date Given using OCS API version "" @@ -637,8 +732,8 @@ Feature: federated And user "Brian" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" And user "Brian" has shared file "/textfile0.txt" with user "Carol" with permissions "read,update,share" And user "Carol" has accepted share "/textfile0.txt" offered by user "Brian" - When user "Carol" from server "LOCAL" shares "/Shares/textfile0.txt" with user "Alice" from server "REMOTE" using the sharing API - And user "Carol" updates the last share using the sharing API with + And user "Carol" from server "LOCAL" has shared "/Shares/textfile0.txt" with user "Alice" from server "REMOTE" + When user "Carol" updates the last share using the sharing API with | expireDate | +3 days | Then the HTTP status code should be "200" And the OCS status code should be "" @@ -650,6 +745,7 @@ Feature: federated | 1 | 100 | | 2 | 200 | + @skipOnOcV10.6 @skipOnOcV10.7 @skipOnOcV10.8.0 Scenario Outline: User modifies expiration date more than the default for federated reshare of a file Given using OCS API version "" @@ -660,8 +756,8 @@ Feature: federated And user "Brian" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" And user "Brian" has shared file "/textfile0.txt" with user "Carol" with permissions "read,update,share" And user "Carol" has accepted share "/textfile0.txt" offered by user "Brian" - When user "Carol" from server "LOCAL" shares "/Shares/textfile0.txt" with user "Alice" from server "REMOTE" using the sharing API - And user "Carol" updates the last share using the sharing API with + And user "Carol" from server "LOCAL" has shared "/Shares/textfile0.txt" with user "Alice" from server "REMOTE" + When user "Carol" updates the last share using the sharing API with | expireDate | +10 days | Then the OCS status code should be "404" And the HTTP status code should be "" diff --git a/tests/acceptance/features/apiShareOperationsToShares1/accessToSharesFolder.feature b/tests/acceptance/features/apiShareOperationsToShares1/accessToSharesFolder.feature index fa01f8942c04..5eaf9db5a6fa 100644 --- a/tests/acceptance/features/apiShareOperationsToShares1/accessToSharesFolder.feature +++ b/tests/acceptance/features/apiShareOperationsToShares1/accessToSharesFolder.feature @@ -56,7 +56,7 @@ Feature: write directly into the folder for received shares And user "Brian" creates folder "/Shares/aFolder" using the WebDAV API And user "Alice" shares folder "/shared" with user "Brian" using the sharing API And user "Brian" accepts share "/shared" offered by user "Alice" using the sharing API - #OCS status code is checked only for Sharing API request + # OCS status code is available only for the Sharing API request Then the OCS status code of responses on all endpoints should be "100" And the HTTP status code of responses on each endpoint should be "201, 201, 200, 200" respectively And as "Brian" folder "/Shares" should exist diff --git a/tests/acceptance/features/bootstrap/AppConfigurationContext.php b/tests/acceptance/features/bootstrap/AppConfigurationContext.php index 1535efb8d8a2..169df0bc5a72 100644 --- a/tests/acceptance/features/bootstrap/AppConfigurationContext.php +++ b/tests/acceptance/features/bootstrap/AppConfigurationContext.php @@ -23,6 +23,7 @@ */ use Behat\Behat\Hook\Scope\BeforeScenarioScope; +use GuzzleHttp\Exception\GuzzleException; use PHPUnit\Framework\Assert; use TestHelpers\AppConfigHelper; use TestHelpers\OcsApiHelper; @@ -47,6 +48,7 @@ class AppConfigurationContext implements Context { * @param string $value * * @return void + * @throws Exception */ public function adminSetsServerParameterToUsingAPI( string $parameter, @@ -68,6 +70,7 @@ public function adminSetsServerParameterToUsingAPI( * @param string $value * * @return void + * @throws Exception */ public function serverParameterHasBeenSetTo(string $parameter, string $app, string $value):void { // The capturing group of the regex always includes the quotes at each @@ -77,6 +80,7 @@ public function serverParameterHasBeenSetTo(string $parameter, string $app, stri } $value = \trim($value, $value[0]); $this->modifyAppConfig($app, $parameter, $value); + $this->featureContext->clearStatusCodeArrays(); } /** @@ -111,6 +115,7 @@ public function theCapabilitiesSettingOfAppParameterShouldBe( * @param string $capabilitiesPath the path to the element * * @return string + * @throws Exception */ public function getAppParameter(string $capabilitiesApp, string $capabilitiesPath):string { return $this->getParameterValueFromXml( @@ -126,6 +131,8 @@ public function getAppParameter(string $capabilitiesApp, string $capabilitiesPat * @param string $username * * @return void + * @throws GuzzleException + * @throws JsonException */ public function userGetsCapabilities(string $username):void { $user = $this->featureContext->getActualUsername($username); @@ -184,6 +191,7 @@ public function theUserGetsCapabilitiesCheckResponse():void { /** * @return string + * @throws Exception */ public function getAdminUsernameForCapabilitiesCheck():string { if (\TestHelpers\OcisHelper::isTestingOnReva()) { @@ -225,6 +233,7 @@ public function theAdministratorGetsCapabilitiesCheckResponse():void { * @param string $exceptionText text to put at the front of exception messages * * @return SimpleXMLElement latest retrieved capabilities in XML format + * @throws Exception */ public function getCapabilitiesXml(string $exceptionText = ''): SimpleXMLElement { if ($exceptionText === '') { @@ -237,6 +246,7 @@ public function getCapabilitiesXml(string $exceptionText = ''): SimpleXMLElement * @param string $exceptionText text to put at the front of exception messages * * @return SimpleXMLElement latest retrieved version data in XML format + * @throws Exception */ public function getVersionXml(string $exceptionText = ''): SimpleXMLElement { if ($exceptionText === '') { @@ -326,6 +336,7 @@ public function parameterValueExistsInXml( * @param string $value * * @return void + * @throws Exception */ public function modifyAppConfig(string $app, string $parameter, string $value):void { AppConfigHelper::modifyAppConfig( @@ -344,6 +355,7 @@ public function modifyAppConfig(string $app, string $parameter, string $value):v * @param array $appParameterValues * * @return void + * @throws Exception */ public function modifyAppConfigs(array $appParameterValues):void { AppConfigHelper::modifyAppConfigs( @@ -362,6 +374,7 @@ public function modifyAppConfigs(array $appParameterValues):void { * @param string $url * * @return void + * @throws GuzzleException */ public function theAdministratorAddsUrlAsTrustedServerUsingTheTestingApi(string $url):void { $adminUser = $this->featureContext->getAdminUsername(); @@ -375,6 +388,7 @@ public function theAdministratorAddsUrlAsTrustedServerUsingTheTestingApi(string ['url' => $this->featureContext->substituteInLineCodes($url)] ); $this->featureContext->setResponse($response); + $this->featureContext->pushToLastStatusCodesArrays(); } /** @@ -456,6 +470,7 @@ public function theTrustedServerListShouldIncludeTheseUrls(TableNode $table):voi * * @return void * @throws Exception + * @throws GuzzleException */ public function theAdministratorHasAddedUrlAsTrustedServer(string $url):void { $this->theAdministratorAddsUrlAsTrustedServerUsingTheTestingApi($url); @@ -475,6 +490,7 @@ public function theAdministratorHasAddedUrlAsTrustedServer(string $url):void { * @param string $url * * @return void + * @throws GuzzleException */ public function theAdministratorDeletesUrlFromTrustedServersUsingTheTestingApi(string $url):void { $adminUser = $this->featureContext->getAdminUsername(); @@ -514,6 +530,7 @@ public function urlShouldNotBeATrustedServer(string $url):void { * @When the administrator deletes all trusted servers using the testing API * * @return void + * @throws GuzzleException */ public function theAdministratorDeletesAllTrustedServersUsingTheTestingApi():void { $adminUser = $this->featureContext->getAdminUsername(); @@ -564,6 +581,7 @@ public function theTrustedServerListShouldBeEmpty():void { * Expires last created share using the testing API * * @return void + * @throws GuzzleException */ public function expireLastCreatedUserShare():void { $adminUser = $this->featureContext->getAdminUsername(); @@ -585,6 +603,7 @@ public function expireLastCreatedUserShare():void { * @Given the administrator has expired the last created share using the testing API * * @return void + * @throws GuzzleException */ public function theAdministratorHasExpiredTheLastCreatedShare():void { $this->expireLastCreatedUserShare(); @@ -599,6 +618,7 @@ public function theAdministratorHasExpiredTheLastCreatedShare():void { * @When the administrator expires the last created share using the testing API * * @return void + * @throws GuzzleException */ public function theAdministratorExpiresTheLastCreatedShare():void { $this->expireLastCreatedUserShare(); diff --git a/tests/acceptance/features/bootstrap/FeatureContext.php b/tests/acceptance/features/bootstrap/FeatureContext.php index 60bc3b8b36db..04a1eefb0abc 100644 --- a/tests/acceptance/features/bootstrap/FeatureContext.php +++ b/tests/acceptance/features/bootstrap/FeatureContext.php @@ -372,12 +372,16 @@ public function getOCSelector(): string { } /** - * @param string $httpStatusCode + * @param string|null $httpStatusCode * * @return void */ - public function pushToLastHttpStatusCodesArray(string $httpStatusCode):void { - \array_push($this->lastHttpStatusCodesArray, $httpStatusCode); + public function pushToLastHttpStatusCodesArray(?string $httpStatusCode=null):void { + if ($httpStatusCode !== null) { + $this->lastHttpStatusCodesArray[] = $httpStatusCode; + } elseif ($this->getResponse()->getStatusCode() !== null) { + $this->lastHttpStatusCodesArray[] = (string)$this->getResponse()->getStatusCode(); + } } /** @@ -393,6 +397,15 @@ public function emptyLastHTTPStatusCodesArray():void { public function emptyLastOCSStatusCodesArray():void { $this->lastOCSStatusCodesArray = []; } + + /** + * @return void + */ + public function clearStatusCodeArrays():void { + $this->emptyLastHTTPStatusCodesArray(); + $this->emptyLastOCSStatusCodesArray(); + } + /** * @param string $ocsStatusCode * @@ -1580,6 +1593,7 @@ public function theHTTPStatusCodeShouldBe($expectedStatusCode, ?string $message $message ); } + $this->emptyLastHTTPStatusCodesArray(); } /** diff --git a/tests/acceptance/features/bootstrap/FederationContext.php b/tests/acceptance/features/bootstrap/FederationContext.php index 51faaa7f98f4..3df79286ff4b 100644 --- a/tests/acceptance/features/bootstrap/FederationContext.php +++ b/tests/acceptance/features/bootstrap/FederationContext.php @@ -57,6 +57,7 @@ class FederationContext implements Context { * @param string|null $expireDate * * @return void + * @throws JsonException */ public function userFromServerSharesWithUserFromServerUsingTheSharingAPI( string $sharerUser, @@ -75,7 +76,6 @@ public function userFromServerSharesWithUserFromServerUsingTheSharingAPI( null, $expireDate ); - $this->featureContext->pushToLastStatusCodesArrays(); } /** @@ -90,6 +90,7 @@ public function userFromServerSharesWithUserFromServerUsingTheSharingAPI( * @param string|null $expireDate * * @return void + * @throws JsonException */ public function userFromServerSharesWithUserFromServerUsingTheSharingAPIWithPermissions( string $sharerUser, @@ -121,6 +122,7 @@ public function userFromServerSharesWithUserFromServerUsingTheSharingAPIWithPerm null, $expireDate ); + $this->featureContext->pushToLastStatusCodesArrays(); $this->featureContext->usingServer($previous); } @@ -156,6 +158,7 @@ public function userFromServerHasSharedWithUserFromServer( $this->featureContext->getResponse() ) . '"' ); + $this->featureContext->emptyLastHTTPStatusCodesArray(); } /** @@ -255,6 +258,7 @@ public function userFromServerAcceptsLastPendingShareUsingTheSharingAPI(string $ "/apps/files_sharing/api/v1/remote_shares/pending/{$share_id}", null ); + $this->featureContext->pushToLastStatusCodesArrays(); $this->featureContext->usingServer($previous); } @@ -273,6 +277,7 @@ public function userFromServerHasAcceptedLastPendingShare(string $user, string $ $server ); $this->ocsContext->assertOCSResponseIndicatesSuccess(); + $this->featureContext->emptyLastHTTPStatusCodesArray(); } /** @@ -303,6 +308,7 @@ public function userRetrievesInformationOfLastFederatedShare(string $user):void * @param string $user * * @return void + * @throws Exception */ public function userShouldHaveNoLastPendingFederatedCloudShare(string $user):void { $this->userGetsTheListOfPendingFederatedCloudShares($user); @@ -313,6 +319,7 @@ public function userShouldHaveNoLastPendingFederatedCloudShare(string $user):voi __METHOD__ . " No pending federated cloud shares were expected, but got unexpectedly." ); + $this->featureContext->emptyLastHTTPStatusCodesArray(); } /** diff --git a/tests/acceptance/features/bootstrap/OCSContext.php b/tests/acceptance/features/bootstrap/OCSContext.php index eb71fda4aad5..016203271d10 100644 --- a/tests/acceptance/features/bootstrap/OCSContext.php +++ b/tests/acceptance/features/bootstrap/OCSContext.php @@ -759,6 +759,7 @@ public function theOCSStatusCodeShouldBe(string $statusCode, $message = ""):void $statusCodes, $message ); + $this->featureContext->emptyLastOCSStatusCodesArray(); } else { if ($message === "") { $message = "OCS status code is not the expected value " . $statusCodes . " got " . $responseStatusCode; diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 8d3e2d4bfc87..778de263b1ad 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -994,6 +994,8 @@ public function addToListOfCreatedPublicLinks(string $name, string $url):void { * @param string $sharingApp * * @return void + * @throws JsonException + * @throws Exception */ public function createShare( string $user, diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 09c95f46f152..6e36acf852f3 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -725,6 +725,8 @@ public function userMovesEntriesUsingTheAPI( * @param string $fileDestination * * @return void + * @throws JsonException + * @throws GuzzleException */ public function userMovesFileUsingTheAPI( string $user, @@ -751,7 +753,6 @@ public function userMovesFileUsingTheAPI( } } try { - $this->emptyLastHTTPStatusCodesArray(); $this->response = $this->makeDavRequest( $user, "MOVE", @@ -2452,6 +2453,7 @@ public function theHTTPStatusCodeOfResponsesOnAllEndpointsShouldBe(int $statusCo \intval($duplicateRemovedStatusCodes[0]), 'Responses did not return expected http status code' ); + $this->emptyLastHTTPStatusCodesArray(); } else { throw new Exception( 'Expected same but found different http status codes of last requested responses.' . @@ -2536,7 +2538,7 @@ public function theHTTPStatusCodeOfResponsesOnAllEndpointsShouldBeOr(string $sta /** * @Then the OCS status code of responses on all endpoints should be :statusCode * - * @param $statusCode + * @param string $statusCode * * @return void * @throws Exception @@ -2549,6 +2551,7 @@ public function theOCSStatusCodeOfResponsesOnAllEndpointsShouldBe(string $status \intval($duplicateRemovedStatusCodes[0]), 'Responses did not return expected ocs status code' ); + $this->emptyLastOCSStatusCodesArray(); } else { throw new Exception( 'Expected same but found different ocs status codes of last requested responses.' . @@ -2860,6 +2863,7 @@ public function userUploadsAFileToEndingWithOfSizeBytes(string $user, string $de * * @return void * @throws Exception + * @throws GuzzleException */ public function userUploadsFilesWithContentTo( string $user, @@ -2891,6 +2895,8 @@ public function userUploadsFilesWithContentTo( * @param string $destination * * @return string[] + * @throws JsonException + * @throws GuzzleException */ public function uploadFileWithContent( string $user, @@ -2955,14 +2961,17 @@ public function adminHasUploadedAFileWithContentTo( * @param string|null $content * @param string $destination * - * @return string[] + * @return void + * @throws GuzzleException + * @throws JsonException */ public function userUploadsAFileWithContentTo( string $user, ?string $content, string $destination - ):array { - return $this->uploadFileWithContent($user, $content, $destination); + ):void { + $this->uploadFileWithContent($user, $content, $destination); + $this->pushToLastHttpStatusCodesArray(); } /** @@ -2973,7 +2982,7 @@ public function userUploadsAFileWithContentTo( * @param TableNode $table * * @return void - * @throws Exception + * @throws Exception|GuzzleException */ public function userUploadsFollowingFilesWithContentTo( string $user, @@ -3560,6 +3569,7 @@ public function userOnHasDeletedFile(string $user, string $server, string $delet * @param string $destination * * @return void + * @throws JsonException | GuzzleException */ public function userCreatesFolder(string $user, string $destination):void { $user = $this->getActualUsername($user); @@ -3573,7 +3583,7 @@ public function userCreatesFolder(string $user, string $destination):void { $this->setResponseXml( HttpRequestHelper::parseResponseAsXml($this->response) ); - $this->pushToLastHttpStatusCodesArray((string) $this->getResponse()->getStatusCode()); + $this->pushToLastHttpStatusCodesArray(); } /** @@ -3583,6 +3593,8 @@ public function userCreatesFolder(string $user, string $destination):void { * @param string $destination * * @return void + * @throws JsonException + * @throws GuzzleException */ public function userHasCreatedFolder(string $user, string $destination):void { $user = $this->getActualUsername($user); @@ -3591,7 +3603,7 @@ public function userHasCreatedFolder(string $user, string $destination):void { ["201", "204"], "HTTP status code was not 201 or 204 while trying to create folder '$destination' for user '$user'" ); - $this->emptyLastHTTPStatusCodesArray(); + $this->clearStatusCodeArrays(); } /** From 9c43ecacf90ef0c450e48ea8a8a08c13ecea9e8e Mon Sep 17 00:00:00 2001 From: Parajuli Kiran Date: Tue, 26 Apr 2022 17:01:47 +0545 Subject: [PATCH 2/2] Fix status code cleanup Signed-off-by: Parajuli Kiran --- tests/acceptance/features/bootstrap/WebDav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 6e36acf852f3..9e701e3ee776 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -3603,7 +3603,7 @@ public function userHasCreatedFolder(string $user, string $destination):void { ["201", "204"], "HTTP status code was not 201 or 204 while trying to create folder '$destination' for user '$user'" ); - $this->clearStatusCodeArrays(); + $this->emptyLastHTTPStatusCodesArray(); } /**