aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2024-05-22 14:17:24 +0100
committerfenn-cs <fenn25.fn@gmail.com>2024-05-29 12:58:37 +0100
commitbd9e2f13a9d0a46e64d843fa54dbd93e351e7930 (patch)
tree6fdc60accebea1e654eafe5b4288e0b7628b6007 /build/integration
parent054722361ee190d0d56a675ba9820e901b501ef3 (diff)
downloadnextcloud-server-bd9e2f13a9d0a46e64d843fa54dbd93e351e7930.tar.gz
nextcloud-server-bd9e2f13a9d0a46e64d843fa54dbd93e351e7930.zip
test(Sharing): Integration test for no expiration set date for share
- Verify that explicitly sending empty `expireDate` param to server overwrite default and sets not expiry date, if non is enforced. - Update tests to avoid converting empty string to date. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'build/integration')
-rw-r--r--build/integration/features/bootstrap/Sharing.php8
-rw-r--r--build/integration/sharing_features/sharing-v1.feature18
2 files changed, 24 insertions, 2 deletions
diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php
index 146b1a35044..c887bc25e98 100644
--- a/build/integration/features/bootstrap/Sharing.php
+++ b/build/integration/features/bootstrap/Sharing.php
@@ -81,7 +81,9 @@ trait Sharing {
$fd = $body->getRowsHash();
if (array_key_exists('expireDate', $fd)) {
$dateModification = $fd['expireDate'];
- $fd['expireDate'] = date('Y-m-d', strtotime($dateModification));
+ if (!empty($dateModification)) {
+ $fd['expireDate'] = date('Y-m-d', strtotime($dateModification));
+ }
}
$options['form_params'] = $fd;
}
@@ -328,7 +330,9 @@ trait Sharing {
public function isFieldInResponse($field, $contentExpected) {
$data = simplexml_load_string($this->response->getBody())->data[0];
if ((string)$field == 'expiration') {
- $contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00";
+ if(!empty($contentExpected)) {
+ $contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00";
+ }
}
if (count($data->element) > 0) {
foreach ($data as $element) {
diff --git a/build/integration/sharing_features/sharing-v1.feature b/build/integration/sharing_features/sharing-v1.feature
index ca030bd3a31..2b5d4e89331 100644
--- a/build/integration/sharing_features/sharing-v1.feature
+++ b/build/integration/sharing_features/sharing-v1.feature
@@ -229,6 +229,24 @@ Feature: sharing
| url | AN_URL |
| mimetype | httpd/unix-directory |
+ Scenario: Creating a new share with expiration date removed, when default expiration is set
+ Given user "user0" exists
+ And user "user1" exists
+ And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
+ And As an "user0"
+ When creating a share with
+ | path | welcome.txt |
+ | shareWith | user1 |
+ | shareType | 0 |
+ | expireDate | |
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And Getting info of last share
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And Share fields of last share match with
+ | expiration ||
+
Scenario: Creating a new public share, updating its password and getting its info
Given user "user0" exists
And As an "user0"