Skip to content

Commit a9c5950

Browse files
committed
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 <[email protected]>
1 parent d185f22 commit a9c5950

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

build/integration/features/bootstrap/Sharing.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ public function asCreatingAShareWith($user, $body) {
8181
$fd = $body->getRowsHash();
8282
if (array_key_exists('expireDate', $fd)) {
8383
$dateModification = $fd['expireDate'];
84-
$fd['expireDate'] = date('Y-m-d', strtotime($dateModification));
84+
if (!empty($dateModification)) {
85+
$fd['expireDate'] = date('Y-m-d', strtotime($dateModification));
86+
}
8587
}
8688
$options['form_params'] = $fd;
8789
}
@@ -328,7 +330,9 @@ public function createShare($user,
328330
public function isFieldInResponse($field, $contentExpected) {
329331
$data = simplexml_load_string($this->response->getBody())->data[0];
330332
if ((string)$field == 'expiration') {
331-
$contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00";
333+
if(!empty($contentExpected)) {
334+
$contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00";
335+
}
332336
}
333337
if (count($data->element) > 0) {
334338
foreach ($data as $element) {

build/integration/sharing_features/sharing-v1.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,24 @@ Feature: sharing
229229
| url | AN_URL |
230230
| mimetype | httpd/unix-directory |
231231

232+
Scenario: Creating a new share with expiration date removed, when default expiration is set
233+
Given user "user0" exists
234+
And user "user1" exists
235+
And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
236+
And As an "user0"
237+
When creating a share with
238+
| path | welcome.txt |
239+
| shareWith | user1 |
240+
| shareType | 0 |
241+
| expireDate | |
242+
Then the OCS status code should be "100"
243+
And the HTTP status code should be "200"
244+
And Getting info of last share
245+
Then the OCS status code should be "100"
246+
And the HTTP status code should be "200"
247+
And Share fields of last share match with
248+
| expiration ||
249+
232250
Scenario: Creating a new public share, updating its password and getting its info
233251
Given user "user0" exists
234252
And As an "user0"

0 commit comments

Comments
 (0)